Here is information for installing, setting and using Forex Expert Advisors for Metatrader 4 and answers to frequently asked questions about working with trading robots on Forex.
First of all: What is an Expert Advisor (EA)? An Expert Advisor is a trading algorithm in the form of mql-code.
Many novice traders somehow associate EAs with something mysterious and magical. There is no magic here – an EA is nothing more than a strategy for manual trading, but automated. If a manual system is unprofitable, then any, even the best, programmer in the world will not help – the EA will trade at a loss.
Installing Expert Advisors
- First, we need to download and install the Metatrader 4 terminal.
- For the first time, having downloaded the archive with an EA a user seeks for .exe file as for installing common programs and usually doesn’t find it. Sometimes system vendors provide such file, but it only distributes files in folders. We may do it ourselves as well.
So, look for files available. Usually, it’s a file of the EA itself (.ех4 or .mql – both are suitable for trade) and some auxiliary files (indicators or libraries).
- You should place the EA file (.ex4 or .mql) in the MQL4/experts folder in your terminal data directory.
To enter the data directory, click File -> Open Data Folder in the terminal.
A folder will be opened. Then go to the MQL4 section and to the Experts directory and copy the files of our EAs therein. Close the folder and restart MT4.
- If there are additional files, it is necessary to distribute them by folders inside the MT4 data directory.
- .dll file is a library that often comes in set with commercial EAs. This file should be placed in the Data folder/MQL4/Libraries
- If there is/are .set file(s) (EA settings templates), they should be placed in Data folder/MQL4/Presets
- Sometimes, there are indicators necessary for the EA in set with it. They are represented by .ех4 (or .mql) files. You should place them in the Data folder/MQL4/Indicators
- Open the trading terminal, go Tools->Options
Select the Expert Advisors tab and enter checks as shown below. Click OK
- Find the window with the name Navigator
If you have no such window, click the button at the top of the terminal.
Click the plus in front of the Expert Advisors section in the navigator window.
From the drop down list, drag with mouse the appropriate EA to the previously opened chart of a currency pair with a timeframe suitable for the work of the EA (it’s usually specified in the description).
- The EA’s configuration window appears. It looks like this:
Here you can change the parameters of the EA, for example, the size of the trading lot. If there was also a template settings file (.set) in set with the EA, you can download this template by clicking the Load button and then select the appropriate file. Similarly, you can save your template settings by clicking Save.
- After changing the settings, click OK. An emoticon will appear at the top right corner of the chart.
When it smiles, it’s ok – the EA operates. If not, click with the right mouse button on the chart with the EA, choose Expert Advisors->Properties (so we transfer to the advisor settings window), select the Common tab and look if there are checks here as shown below.
You also need to verify that the auto-trade button
at the top of the terminal be green; if it’s red, click it with mouse.
- Basic settings
Settings can be expressed in numbers (for example, a trading lot) or in the form of “true/false”.
True means “turned on”.
False means “turned off”.
I.e., if there is a choice of true/false near a parameter, thus we can turn it on (true) or off (false).
Of course, the parameters description will be very different for different advisers, but there are a number of settings that are repeated in the majority of the EAs:
Lotsize means a trade lot size to be used by an EA.
MicroLots – true/false; trading by micro lots 0.01, 0.02, 0.03….
MoneyManagement – true/false; when this option is enabled, the EA will determine itself a size of the trading lot.
Comment means a comment to EAs’ orders. It is necessary for you to be able then, when studying the history of trades, to distinguish the EA’s positions from other orders (open by hand or with the help of other experts).
MagicNumber means a code, by which the EA determines its positions, can be any. However, it is impossible that two advisors on the same account have the same MagicNumbe. Otherwise there can be confusion with orders.
GmtOffset – installation of conformity with GMToffset.
Answers to frequently asked questions on work with EAs
Q.: I’ve installed the EA, and 2 hours have passed, but it doesn’t open positions. What’s wrong?
A.: That’s right. The EA will open an order only when there are favorable conditions. Be patient. You should know that EAs that trade very often (a big greeting to Ilan) usually blow down their deposits. Do you need this? It is better to trade more rarely, but more productively.
Q.: I try to change the settings, but they aren’t changed – when I open my settings once more, they are the same!!!
A.: You should change the EA’s parameters on the chart with the attached EA, but not in the navigator window.
Q.: Why is the EA’s icon in the navigator window gray but not colored? Isn’t it active?
A.: It’s active. It just means that you have no source mql-code. If you are not familiar with programming, there is no difference for you. The EA will still trade as well.
Q.: The EA has closed the position at a loss!!! I’m in panic! Should I change something in the settings?
A.: It’s not necessary to change something. The EA isn’t a magic machine that knows where the market will go. It’s normal for an EA to generate negative positions. We are concerned that the number of profitable trades exceed the number of losing ones and, as a result, the robot give a positive balance growth of our account.
Q.: There are indicators in set with the EA. What should I do with them? Should I set them on the chart?
A.: If additional Forex indicators are used in the EA’s work, they should be placed in the Data folder/MQL4/Indicators folder. It’s not necessary to set them on the chart; it’s sufficient to attach only the EA.
Q.: Can I run two different EAs on the same account simultaneously?
A.: Yes, of course. You should open a separate window with the chart for each EA and in any case, their MagicNumbers shouldn’t be the same.
Q.: And how can I simultaneously run two terminals of the same DC? I want real time trading and demo one to work at the same time.
A.: For this purpose you should install a second terminal in a folder with a different name. For example, Metatrader4-2.
Q.: Is it possible to trade manually on the account where the EA operates?
A.: Yes, it is. The advisor will not touch your orders.
Q.: Can I manually close the orders opened by the EA?
A.: Yes, you can. But be careful: not all robots perceive adequately the orders closing manually. For example, after you’ve closed an order, the EA can re-open the same one.
Q.: I’ve downloaded the EA, but it is not tested. What’s the matter?
A.: If the advisor has the AutoGmT parameter, you should disconnect it and set it manually to let it work in the Strategy Tester.
Q.: Will the EA continue its work if I close the terminal or turn off the computer?
A.: No, it won’t. The computer and the terminal should work. As an option, you can consider using the VPS.
Q.: What if I restart my computer and open the terminal again? Will the EA continue to work or need I re-set it?
A.: In this case, the EA will continue its work without problem. But if a signal for the opening position occurs at the time you restart the computer, the EA may miss it because It didn’t work during the occurrence of the signal.
Q.: And how can I test the EA on historical data?
A.: See video lesson “How to Test the Adviser”.
Q.: I have several EAs trading on my account. How to calculate the profitability of each of them separately?
A.: See “How Do I Know How Much Profit Each EA Have Generated?”
Sincerely yours, Pavel