# Review of the MT4 Strategy Tester. Part 6 (Problems of optimization and testing. Tips for optimization)

[ad_1]

In the final part, we will focus on the problems of optimization of Expert Advisors in MT4. And there are many of them. In the last review, you probably noticed that some of the tester’s optimization functions do not work correctly. For example, it is not possible to add your own key criterion to which the system is fitted.

Another problem is the lack of duplicate settings. For example, in FxBlue the same settings can / must be set sometimes in 2 or more places. At first glance, this seems superfluous until you come across an MT4 tester. After starting the optimization, the report turns out to be empty only because somewhere in some 10th tab of the 2nd window the checkbox is incorrectly checked or a parameter is specified that contradicts the parameter in the 5th window of the 3rd tab. An example is figurative, but it is far from always possible to determine the error from the log, and the trader has to revise all the settings again, trying to find a discrepancy.

## Optimization problems in MT4

In general, the optimization problems in MT4 were considered in this review, and it would make sense to reveal some of them in more detail.

**Work only with****In-****Sample by sampling.**As stated in the overview at the link above, Out-of-Sample optimization is correct. In-Sample is a method of running an Expert Advisor only for separately taken data of a selected interval, where equity and mathematical expectation are adjusted to the desired parameters. It is logical that in working mode the EA shows results that are far from the test.

The Out-of-Sample method (something like the forward testing described in the previous part) provides the following actions:

- The testing interval is several years. At least 5 years old. One of the mistakes novice traders make is the desire to save time. It seems to them that 200-300 trades are sufficient for a sample, therefore the interval of 1-2 years is indicated in the settings.
- The interval is divided into 3 segments. The first 2 segments are the sections where optimization in MT4 will take place – the parameters will be adjusted to the required result.
- After comparatively the same optimal results were obtained in both sections, the system is run in the 3rd section. If the backtest differs greatly from the one that was received in the previous sections, the system is considered inoperative.

In MT4, the Out-of-Sample method is not available, but the MQL website (MT developers) has the Walk-Forward Optimization (WFO) and Walk-Forward Reporter libraries, with which you can pass step-by-step forward testing. There you can also find instructions for working with these add-ins. You will need help finding them in MQL – write in the comments.

This is an example of a picture describing how the above library and script work, taken from the site.

**Cyclicity and market volatility.**Despite the fact that the market is cyclical, the duration and amplitude of the waves are different, therefore, adjusting the waters of the Elliott wave theory does not make sense (although it can be used as an auxiliary tool). There is a recommendation: do not rely on the fact that optimization in MT4 will allow you to create an ideal program that works in all sectors of the market. There are three ways out of the situation:

- Take into account that after optimization in MT4 on a real account, the result will be worse. That is, to put it at risk.
- Donate profit. Establish universal parameters that will be consistently effective in all areas. It is logical that we will not talk about the maximum possible profit. The goal is at least to avoid loss.
- Break the interval into sections – flat, different sessions, beginning and end of the day, fundamental bursts. Drive out the advisor at each site. Where it will be most effective is where it will be launched.

**Trade costs**… Broker’s commission is usually floating and is almost not taken into account in MT4 optimization. You can specify the spread manually, but what about swaps? And what about a situation when spreads widen sharply in a volatile market, sometimes catching stops? In this situation, a system optimized in greenhouse conditions will instantly fail. It is also worth adding slippage here. Alas, there is no solution to this question (if you know it, share it in the comments!). Or you can use accounts with a fixed spread.**Resistance of the advisor to changing settings**… An Expert Advisor that has undergone optimization is far from the fact that it is ready to launch on the real market. Although the settings are optimally selected, this is not enough. If, with a slight change in the settings (for example, from 10 to 8), the backtest statistics sharply change for the worse, the EA cannot be launched.

Other problems include the actions of market makers, who at any time can make their own adjustments to the direction of price movement, the quality of quotes loaded into the tester.

The rest of the factors have already been mentioned in the review at the link above.

**Recommendations for optimizing robots in MT4:**

- The time interval is at least 5 years. For systems operating at minute (short intervals) a year is sufficient.
- Do not try to optimize the EA for several parameters at the same time (for example, to get the maximum profit with the minimum drawdown). You have to sacrifice something. Artificially adjusted systems do not work on a real account.
- Set the parameter change step relatively large. In some areas, it can be reduced later. This will save time.
- Do not set optimization in MT4 as a goal, anyway, the EA will need to be adjusted again from time to time. Why waste extra time?

Working with testing and optimization is a routine job that requires patience and knowledge. Manual strategies seem simpler, but who said Forex trading is easy? If someone earns, someone loses. And the one who is more persistent, faster and better achieves success! If you have any additions for optimization in MT4, we invite you to discuss in the comments!

[ad_2]