Selius · XMQAAlgosLearnTelegram

Learn

Out-of-sample and walk-forward testing in MT5, step by step

Optimising an EA on the same data you test it on guarantees a pretty result and proves nothing. Here's how to use out-of-sample and forward testing in the MT5 Strategy Tester.

The problem with optimisation

Give an optimiser enough inputs and enough data, and it will find settings that fit the past perfectly, including its noise. Those settings usually fail on data they haven't seen. The fix is simple: keep some data the optimiser never touches.

Built-in forward testing

In the Strategy Tester, set Forward to 1/2, 1/3 or 1/4 (or a custom date). MT5 optimises on the first part and automatically re-runs the best results on the forward part. Sort by the forward results: settings that hold up on both parts are the interesting ones.

Manual walk-forward

  1. Optimise on year 1 with as few inputs as possible (3 or fewer is a good discipline).
  2. Freeze the preset and test it on year 2 without changes.
  3. Roll forward: optimise on year 2, test on year 3.
  4. Look at the chain of out-of-sample results, not at the best in-sample one.

What good looks like

Out-of-sample results will almost always be weaker than in-sample. That's normal. What you're looking for is similar behaviour: comparable drawdown, trade frequency and win rate. A system that collapses out of sample was fitted to noise.

Questions

How much data should I hold back?
A common choice is 25–33% of the period, and at least enough for a few hundred trades.
Is walk-forward the same as live testing?
No. It's still historical. A demo or small live account running alongside is the next step.

Put it into practice. Algo Dispensary drops VERUM-screened MT5 EAs every weekday and runs a weekly testing challenge. Members get Vidette, our equity-guard EA, free.

Join Algo DispensaryBrowse the algos

More guides