What would you think is necessary to print data like your Account Balance or your Account Equity, your Trading profit or your Brokers spread directly on the chart on your computer screen? When I started to deal with automated trading, I had to spend lots of time with the classic fundamentals. Like learning data types and creating the stone-aged Hello World programs. I can tell you, it is hard to focus on these dust-dry thinks if your subconcious mind has nothing that could motivate you to do that. I don t know about you, but I need to see a benefit to put in all the effort it takes. Even if it is only 5 minutes. So here is my version of your first programming example, that will allow you to watch a relevant output that will be automatically drawn and refreshed on your chart with every price change. To follow these instructions you might want to open this episode on TradingTutorialAutomation.com because in the show notes I will include the screenshots that show the whole process. Step 1: Open your Metatrader 4 By now you should already have downloaded and installed Metatrader 4. If not, go to the previous episodes of this course. Step 2: Start your Automation Command Centre After your Metatrader 4 opens, hit the F4 Key on your keyboard. That will bring up the Metaeditor. See the show notes for details. 1 of 6 31.03.2015 22:50
Now hit Control N, that will bring up the MQL4 Wizard. Select Expert Advisor. 2 of 6 31.03.2015 22:50
Click Next and complete the entry in the field Name with the name AccountInfo for your first Expert Advisor, as seen in the screenshot in the show notes. Click on Next each time a new dialog comes up. Step 3: Write your first magic line of code Now you should see the Metaeditor create some code. Find the entry OnTick. This is the event, that runs every time a price change occurs. In the OnTick part, right above the closing bracket write the following line of MQL4 code. Comment (AccountBalance()); 3 of 6 31.03.2015 22:50
See the show notes on TradingTutorialAutomation.com for the exact syntax. Step 4: Compiling your first MQL4 program To finish your work, you now have to compile your first self written Expert Advisor to make it usable in Metatrader 4. This is done by hitting the F7 key - or clicking on the compile button. If you have done everything right, you should now be rewarded by a compiler response saying 0 errors, 0 warnings. 4 of 6 31.03.2015 22:50
Step 5: Testing your first automated Expert Advisor Now hit the F4 key again to return to your Metatrader. After you have successfully compiled your program in the last step, you will see it on the left side in the Navigator view. To test it, simply drag it onto the chart with your mouse. 5 of 6 31.03.2015 22:50
Congratulations, if you have done everything right, you should now magically see appear a line with your account balance in the left upper corner of your chart. And on the right upper corner you should see a little smiley and the name of your first, self written program. You have just written your first complete working Trading Automation Module in under 5 minutes. Did it hurt? No, I don t think so. It is the proof that you can do it and it is the first step to go for more. You want to print out your Equity, your trading profit, the strength of the trend or any other trading related information directly on your Metatrader charts? No problem, just go to the next episode or become a Golden Goose Course member on TradingTutorialAutomation.com right now. 6 of 6 31.03.2015 22:50