MT5 – Walk Forward Matrix

Algorithmic trading consists not only of planning and development of trading robots but also (to a greater extent) testing and verifying the survivability of ideas and algorithms implemented in them. MetaTrader 5 provides the built-in tester for optimizing Expert Advisors on historical data. This tool is often indispensable in everyday activity. However, its main issue is the search for parameters that remain steadily profitable over time beyond the period the optimization was performed on. One of the possible solutions is forward testing. The tester features the appropriate built-in mode. But is it enough to optimize the EA once and successfully check it on a subsequent period to ensure its reliability?
The EA’s operation cycle implies that the optimization and trade stages are repeated from time to time with the chosen frequency, and traders expect positive (or at least loss-free) results over a long period of time. To ensure the system’s efficiency, it is necessary to repeat the cycle stages many times in the tester launching optimization and forward testing with a constant shift of the current period from the past to the virtual future.
This is called the walk forward optimization and widely used by many traders. Unfortunately, the built-in MetaTrader tester does not allow launching it at the touch of a button. Instead, we have to automate the tester launch using external tools and stick forward test reports together. Therefore, there is a need to execute a walk forward analysis in a simpler way solely by means of MetaTrader and MQL with no routine operations.
3D graph of optimized values from the time period 2017 – 2019:
3D graph of forward test values from the time period 2020 – 2021. Results are matched in the walk-forward matrix, which guarantees a similar profit in the optimized period 2017 – 2019 and in the forward test 2020 – 2021. This proves that the trading algorithm is not over-optimized: