WalkForwardDemo MT5

WalkForwardDemo is an expert adviser (EA) demonstrating how the built-in library WalkForwardOptimizer (WFO) for walk-forward optimization works. It allows you to easily optimize, view and analyze your EA performance and robustness in unknown trading conditions of future. You may find more details about walk-forward optimization in Wikipedia.

Once you have performed optimization using WFO, the library generates special global variables (saved in an "archived" file with GVF-extension) and a CSV-file with resulting data in the MQL5/Files folder. Once this is done, the data is used to build an HTML page with overview of the optimization. The names of GVF and HTML files correspond to CSV file name, initially specified in EA input wfo_outputFile.

EA is generated by MQL5 Wizard and based on 2 strategies - Envelopes and WPR. The principles of operation of such EAs and its input parameters are described in the documentation - Models of Trade Signals.

An example of parameter set for EA optimization can be found in the product comments.

Report types

Depending from input parameters given for WFO library, it can generate different report types from the resulting data.

Standard walk-forward report with a table of passes containing performance indicators for in-sample and out-of-sample periods in the same row, and overall performance for entire aggregated forward period. The report is generated for rolling walk-forward analysis and as a drill down for cluster analysis;

Cluster report with a set of tables, containing annualized profit, efficiency, consistency, completeness, and number of days in step for selected combinations of window sizes and forward step sizes. This report is generated after clustered walk-forward optimization;

Anchored walk-forward report is similar to standard report except for that window size changes in every pass (row).

Standard and anchored reports show pass number in the 1-st column. Until MetaTrader is closed you may check every single pass by opening Optimization Results tab in the tester, double-clicking a row with required parameters - this will select optimal inputs from this pass into EA, so you can then start a test run.

In standard reports, in-sample optimization data is highlighted with blue color, and out-of-sample data - with yellow. If the latest pass contains forward step overlapping with current time it's highlighted in green, indicating that this is the latest known parameters applicable for trading right now.

Performance indicators

Annualized profit is a hypothetical profit which EA could earn in a year if optimization period profit and forward period profit are re-scaled proportionally to their length.

Efficiency is a ratio of annualized profits of forward and back periods.

Consistency is a fraction of profitable forward passes in aggregated forward period.

Completeness shows how many rolling passes was performed for specified combination of optimization window size and forward step size, can be less than requested number during genetic optimization, because this method skips some parameters values.

Number of days is suitable for converting step size in percent into days.

Improvement in the reporter: if optimization window size or forward step size is constant, cluster report is shown as a single table, which contains all performance indicators - each in a separate row.