- How do you run a walk-forward analysis in MetaTrader 5?
- MT5 gives you the pieces rather than the loop. Set Forward on the Strategy Tester's Settings tab to 1/2, 1/3 or 1/4: the tester optimises on the front of your date range and scores the surviving passes on the tail, which it lists in its own Forward Results tab. That is one step. For a series, shift the whole date range forward by the step length and run the optimisation again, once per segment, recording the forward row and the winning inputs each time. Twenty segments means twenty runs.
- What should the in-sample and out-of-sample window lengths be?
- Long enough that the training window holds more than one regime and the test window holds enough trades to mean anything. The tester's built-in ratios of 1/2, 1/3 and 1/4 make sensible starting points, and a custom forward date gives a shorter test slice when the step is small. The rule matters more than the numbers: pick the ratio before the first run, because trying several and publishing the best repeats the mistake walk-forward exists to catch.
- Does walk-forward analysis eliminate overfitting?
- No. It relocates it and makes it visible. The re-fitting still happens inside each training window, so the method measures how much of that fitting survives contact with the next window instead of preventing it. Our own eight recorded searches ran 116 parameter combinations and adopted none: two of them cleared the window after the search and then failed the window before it, which is exactly the pattern a single hold-out hides.
- What counts as a good out-of-sample efficiency?
- Roughly 40-60% is ordinary once a handful of inputs move, and figures above 60% held across most steps with stable inputs count as strong. Treat any single step with suspicion: our best-fitting search read 65% on one step and its chosen setting still lost money on both windows it had not seen. A figure near or above 100% more often signals a leak between the training and testing windows than an unusually robust strategy.
- Which optimisation criterion should rank the passes?
- Decide before the grid appears, because the criterion — the objective function, in the wider literature — picks the winning pass at every step. Balance-based ranking rewards whichever pass took the most risk, drawdown-based ranking rewards whichever traded least, and Custom max hands the decision to your own OnTester() when neither fits. In our recorded searches the tester's ranking never settled anything on its own: every surviving pass then had to hold a profit factor above 1.0 on three windows, and not one of the eight managed it.
- How does walk-forward differ from a single out-of-sample test?
- A single test reserves one block of data and checks the final parameters against it once. Walk-forward repeats the tune-then-test cycle along the whole history, so it returns a series of out-of-sample results and tests the re-fitting procedure itself — the thing a deployer actually performs month after month.