Written and compiled scripts, so-called Expert Advisors, can be run on the MetaTrader 4 and 5 terminals. Many professional traders create such software for personal use and for sale. This provoked the emergence of a whole market of user programs distributed both for free and with the condition of a one-time payment or subscription.
How to choose Expert Advisors
High-quality programs for working with the forex market can be found in our store: https://trading-go.ru/advisors/
All our Expert Advisors contain open and re-tested strategies. They were tested not only in demo versions, but also in real conditions. And the test results are attached to each of them. Thanks to this, the trader can get fully automated and well-tested algorithms.
Taking into account the fact that the robot gets access to a real deposit, the right conducted express assessment is of great importance when choosing it. But in real life, many Expert Advisors sellers offer low-quality programs. Therefore, you should not always rely too much on the attached results.
There are only two way to check the program for compliance with the trading strategy, for code errors and for real profitability. Any MetaTrader user can check the effectiveness of the program via the strategy tester or run the program on a training demo account. Let’s take a closer look on both ways of testing.
Testing Expert Advisor in the MetaTrader 4 terminal
In fact, a custom script with the coded strategy for MetaTrader 4 is a ex4 or mql4 file. The trader should ensure the correct path when installing an Expert Advisor, so that it can be run on the MetaTrader 4 platform without problems. It looks like an ordinary file copying, but there is one important feature - – the folder for placing the Expert Advisor files is opened via the running trading terminal.
Step No. 1. The first step for the trader that the Expert Advisor is intended for the MetaTrader 4 terminal. This is usually stated in its description. You should also check the extension (ex4 or mql4).
For demonstration purposes, we will install the VR Smart Grid robot (Expert Advisor), which consists of a single file.
Step No. 2. You should launch the MetaTrader 4 trading platform.
Step No. 3. To open the installation folders of the Expert Advisor files, you should to do the following:
- go to the terminal menu;
- select the «"File"» tab;
- click the «"Data catalog"».
As a result, the user gets access to the folder window. The MQL4 folder is used to save the Expert Advisor. Indicators, auxiliary libraries, templates, presets, and other software related to the custom configuration of the platform can be saved in it,
The authenticity of the names allows you to immediately find where to copy the Expert Advisor files.
Step No. 4. Following the recommendations attached to the Expert Advisor, files with its settings and distribution are distributed to the corresponding folders.
This can be done by taking the extensions as a guide:
- the Experts directory — ex4 and mql4;
- the Libraries folder— dll libraries;
- the Presets folder — presets files.
In our example, the VR Smart Grid file is copied to the Experts folder.
If the Expert Advisor is installed correctly, its name will appear in the «Navigator», after the MetaTrader 4 restart.
Step No. 5. The final stage befor testing is to download ticks history.
After selecting the instruments you want to work with, it is necessary to press F2. A window opens in which you should to do the following:
- select the desired currency pair or CFD contract;
- activate the «"Download"» button.
After that, the green bar will appear at the bottom of the window, which shows the process of downloading the tick history.
If the history has been loaded into the MetaTrader 4 terminal before (and no new data has been received from the broker's server), a message appears with a suggestion to reload timeframes. In this case, you should make the suggested update of tick data.
Thanks to the downloaded archive of quotations, the strategy tester has a database. It allows you to restore and display candlesticks when recreating the trading history.
Using the strategy tester
Using the strategy tester allows you to test faster. And this way has already proven itself in pre-testing of various scripts.
Preparation of the strategy tester
To manage the strategy tester in the MetaTrader 4 workspace, there is a special window at the bottom. In it, the trader can test or optimize trading systems and keep track of current positions at the same time.
The user can open this service at any time. You just need enter the platform menu and select the «"View"» section or use the keyboard shortcuts (Ctrl + R), the combination of which is displayed near the strategy tester menu item.
The goal of developers was to make that this application native. Therefore, a trader who knows how to work with the MetaTrader 4 platform can easily use the tester. But some of its functions are quite specific.
Setting up properties of the strategy tester
The Expert Advisor properties are located in the right corner of the strategy tester. They are used to set up test modes.
There are three tabs here:
- input parameters;
Optimization is not recommended when the initial run of the Expert Advisor is performed. You should also not attempt to adjust the parameters of the conditions and indicators included in the trading system.
The optimization system uses a « "genetic algorithm" » that can effectively improve the performance of the test. The side result of his work is parameters tailoring for a specific historical period and instrument loaded into the registry.
In real trades, when the robot faced with another form of fluctuations (gaps, volatility, etc.), this is likely to result in significant losses.
The "Testing" tab is used to define various parameters:
- the starting size of the deposit
- the currencies;
- the directions of trade (transactions of only one type or in both directions);
- the type of optimization.
It is important to keep in mind that the Expert Advisor's correct operation during testing is achieved only if the settings (recommended by the developer of the trading network or set by default) are not changed.
The VR Smart Grid robot that we use as an example, has similar custom settings files, which after downloading them should be placed in the Presets folder.
To find them, you need to do the following in the terminal:
- open the « "Data Catalog" » folder;
- go to the MQL folder;
- select Presets.
Then, in the strategy tester, you need to click the « "Upload" » button and select the desired file in the window that pops up. Often, the « "Tester" » folder is opened by default when you select a download, so use Windows navigation to open the catalog tree and find the Presets folder.
When you open the test service, the default option « "Expert Advisor" » is set. It automatically displays the entire list of robots in the Navigator window and the Experts folder.
If you select the second option — indicator, a list of files in the Indicators folder will be displayed.
To run the Expert Advisor test, just double-click on its name in the drop-down list. Next, the instrument, according to the quotes of which the effectiveness of the trading system will be checked, is selected in the same way. One click is enough to display it in the settings window.
Using the "Model" function, the testing time and its accuracy are set. Activating the "every tick" method restores historical quotes using all data of the archive, so it is the longest. However, the other two types do not provide an accurate assessment and are used at the stage of testing "trading hypotheses" to save time while searching for ideas.
If the user « "tied" » the robot to a long-term strategy where the transactions are opened at the price of opening a bar (candle) at the beginning of trading, then you can use a model with the appropriate name. This is done to "rush" the Expert Advisor through the maximum time period.
The duration and accuracy of the test is affected by the date or length of the historical segment. Some traders believe that the bigger this indicator is the better.
However, practical experience tells a different story:
- It is much more important to choose a section with the most even (symmetrical) distribution of the upward trend, various volatility levels, flat.
- A segment from 2,000 to 10,000 bars or candles of the working time frame — selected in the « "Period" » field would be enough.
Starting the testing process, the trader checks the logic of opening and closing transactions. As well as the work of money management:
- automatic placement of pending orders;
- fixing profit and losses.
Thanks to the visualization option, the trader can personally observe these processes in the « "High-speed run" » mode of trading sessions.
After setting all the above settings, many launch the test by activating the « "Start" » button. But at the same time, they ignore the « "Spread" » parameter, where the default value is « "Current" ».
This should not be done for the following reasons:
- When testing at the weekend when the market is closed, the spread on the instruments may be implausibly overstated.
- In real trades, the spread values can change, besides there will be is necessary to remember about slippages.
Very often, traders input the spread value manually, higher by one point of its real value, in order to protect themselves from losses described above.
Launching the testing
After choosing the method of modeling the trading history and the length of the segment, you can go from the visualization to the input parameters to set the lot size at 0.01. This will help to display the dimension of the test report indicators in points, which will make the analysis of test results convenient.
Testing starts by the « "Start" » button and passes automatically. At the same time, only the segment selected on the visualization is displayed on the chart of the instrument (which appears at the top). For the convenience of observation, the trader is given the opportunity to pause or accelerate. This is done by moving the slider to reduce or expand.
If the « "every tick" » method is selected, the candles are recreated in the tester and the price produces fluctuations, almost with reliable accuracy. This allows to display transactions not at the opening and closing price, but directly "inside" the candle.
Analysis of the test results
After the test is finished, new tabs are added to the service, which were not present at the tester startup stage:
In order to preliminary evaluate how effective the trading algorithm is, three methods of checking the results are used:
- Generalized — with the help of the yield-equity curve graphical analysis.
- Mathematically — by checking the correspondence of the obtained parameters to valid theoretical values.
- Step-by-step — considering every transaction on the chart and in the results table.
The stability of the Expert Advisor code is determined by the tester log.
« Results » tab
It contains a detailed descriptions of the completed or modified trade transactions. You can also view the results of trades and pending orders here. All information is displayed in a convenient table.
« Graph » tab
There are two fields here. The first one contains two lines: balance is in blue, and the equity is in green. The second one shows a histogram of position size.
« Report » tab
This tab displays a table that contains the testing results in numbers.
« Journal » tab
Here the user can get acquainted with a step by step report on the work of the Expert Advisor.
Anyone who wants to start using Expert Advisors in their trading, we recommend visiting our store: https://trading-go.net/advisors/ Here you will find quality programs for working with the market, and you can test them for free.