Review of the MT4 Strategy Tester. Part 5
Optimization of the advisor is required in two cases: the result obtained after the robot has run over the historical interval does not correspond to expectations. And the second case: a robot launched on the real market deviated from the testing parameters for the worse (the market is volatile, therefore this situation is the norm). The essence of optimization comes down to changing the tester’s settings or changing the scope of the advisor.
Optimization of the Expert Advisor in the MT4 Tester
The MT4 tester provides a function of automatic enumeration of indicator settings with a given step. In theory, this search should produce the optimal combination that gives the best result. To start, activate the “Optimization” function in the tester window, set the simulation type “Every tick” before starting.
Step 1. Open the “Expert Advisor Properties” and set the parameters in the “Testing” tab, setting the main criterion – the program will focus on it during the EA optimization:
- Balance. The ratio of maximum profit to balance. The best combination will be considered the set of parameters where the performance will strive to the maximum.
- Profit Factor. The tester adjusts to the ratio of trades with profit and loss. The optimal combination will be the one with the maximum number of plus deals. However, this does not mean the final profitability of the EA.
- Expected Payoff. Mathematical expectation – it must exceed the spread (that is, the total trading costs).
- Maximal Drawdown. Maximum drawdown. The best combination is the one where it is minimal (and certainly not more than the initial deposit).
- Drawdown Percent. Relative drawdown.
- Custom. In theory, a trader can include his key optimization parameter in the list here, but according to reviews on the forums, this item does not work.
It is better not to remove the activation of the “Genetic Algorithm”, since then all possible combinations will be launched. The effectiveness of this is questionable, but it will take a lot of time.
Step. 2. Input parameters:
We put a tick in front of those parameters that will participate in the optimization (change when looking through combinations). The more checkboxes are checked, the more possible combinations will be and the longer the optimization will take.
Each parameter has several basic values:
- Value is a parameter that is currently set in the EA.
- Start – the initial value of the parameter.
- Step – the interval by which the parameter will increase from the starting criterion for each subsequent combination.
- Stop is the boundary value of the parameter.
The meaning of these values is as follows. The trader understands that for a given strategy, the minimum stop should be 15 points, but he does not know what its optimal value is given the existing volatility. Although he understands that it makes no sense to put more than 40 points. He sets these restrictions in this window, excluding deliberately inappropriate sites. Similarly, with the setting of the step. You can set the minimum step, but if the stop is not 13, but 14 points, will it be of principle? It is unlikely, and the optimization of the EA will take a long time.
Step 3. Optimization… This tab also sets the starting and limiting criteria for various parameters. For example, set requirements for the minimum profit, maximum drawdown, etc.
One of the drawbacks of the MT4 tester is the lack of the ability to choose an Expert Advisor optimization option (which is provided in MT5). The essence of the options boils down to the following:
- Optimization of 2 equal intervals between each other. One interval is divided into 2 parts, the same combination of indicator settings is run on both, and optimized. The best is the set of parameters where the backtest results are approximately the same.
- Forward testing. The interval is divided into three sections. Testing takes place on the first two, the best results are optimized on the third (general principle).
- Backward testing. On the first part of the interval, the robot is tested, on the second, it undergoes testing and optimization, the best several options are run through the third part of the interval, then the best one is launched again on the first segment and over the entire interval.
In the next part, we will tell you more about the problems a trader will face when optimizing advisors.