Please see: http://forums.babypips.com/expert-advisors-automated-trading/51473-automated-trading-howto-mt4.html when you don’t understand where this relates to.
First I want you to introduce to the basic template I am using for the thread. This is the most basic as it egts and it will grow over time. I just want to make sure that we have the same starting point. Each script shared will run on its own, so there is no need to copy and paste stuff if you want to use only that script. When you want to make your own, you need to copy sections and paste them in you own script.
The basic template I use is the standard EA template generated by Metaeditor, the scripting and compiling tool that comes with your MT4. It is called: metaeditor.exe or you can find it by clicking F4, when you are in your MT4 program.
Create a new template in metaeditor, and you can choose from a selection. The one used here is the ‘Expert Advisor’, and it will look like the file I attached.
There are more templates, the ones you probably will only use when you are not too fancy are:
- Expert Advisor
- Custom Indicator
- Script.
I’ll explain the difference in a very simplified manned:
-
Expert Advisor: runs continuous on the chart you attached it to. It can include indicators and is able to trade (when coded).
-
Custom Indicator: runs continuous, but can’t trade. You can make your own indicator, just like the moving averages ons in MT4. I build EAs, so I won’t be looking at these so often.
-
Scripts: Like EAs, but they only run one cycle. It does what is asked and it stops. I will use these in my thread to set some variables, like to turn the EA on or off.
Each have their own location directory:
- Expert Advisor: C:\Metatrader4\experts
- Custom Indicator: C:\Metatrader4\experts\indicators
- Scripts: C:\Metatrader4\experts\scripts
Files MUST be located in these directories to work. They will only work when compiled, so you need to open them in metaeditor.exe and click on F5.
Please, open the attached file in Metaeditor and have a look at it, I will explain some more later. With F5 in Metaeditor, you compile the script, meaning that it can be executed by MT4. A copy of the file will be saved with the extension .EX4. Scripts that you can edit have the extension .mq4
Line_Notification.zip (440 Bytes)