Page 1 of 1

Walk-forward testing explained with a simple example

Posted: Sun Nov 01, 2026 2:56 pm
by FXS London Scalper
Optimising an EA on historical data often produces parameters that fit the past but fail in the future. Walk-forward testing is one way to check whether optimisation generalises.

A simple version: split data into consecutive windows, for example two years for optimisation followed by six months for testing. Optimise on the first window, apply the best parameters to the next six months without changes, record the result. Then move both windows forward and repeat.

A worked example: across five windows, the optimised results might show strong profits each time, while the out-of-sample periods show mixed results. That gap measures how much of the optimisation was curve fitting.

If out-of-sample results are consistently positive, though smaller, the strategy may have a real edge. If they hover around zero, the optimisation was likely fitting noise.

MetaTrader 5 includes a forward testing option, though a manual walk-forward gives more control.

Has anyone run walk-forward tests on their EAs?