Walk-forward optimization library for MetaTrader

15 August 2016, 19:42
Stanislav Korotky
1 979

This post is the main page of documentation of WalkForwardOptimizer library for MetaTrader4/5.


Walk-forward optimization (WFO) is intended for making sure that optimized expert adviser (EA) will most likely keep its performance in future, on unknown data. This is done by running forward test for EA on a so-called out-of-sample data which was not used during optimization on so-called in-sample data, and the process of optimization and testing is repeated multiple times with shifts of the work window in future. Here is an article about walk-forward optimization in Wikipedia.

In this documentation the following terms are used as well:

In-sample data = optimization window

Out-of-sample data = forward test step

If average performance of EA on forward tests remains acceptable, it confirms robustness of EA. Otherwise, either your optimization setup or EA strategy in itself does not provide generalization required to succeed in future, so you need to change something.

MetaTrader does not provide a built-in walk-forward testing (MetaTrader 5 does afford single forward testing, which is rudimentary and far from full-fledged walk-forward analysis). To workaround this limitation one can use the complex of WalkForwardOptimizer library and WalkForwardReporter (WFR) script. 

Walk-Forward Optimization library for MetaTrader 4


User Guide

Header file and code example (WFO MT4 product page)

Header file and code example (WFO MT5 product page)



Estimator formula reference

Building reports (WFR MT4 product page)

"How To"s


Walk-Forward Products Overview

Article: Custom Walk-Forward Optimization

Share it with friends: