Learn · Walk-forward validation

What is walk-forward validation?

Reviewed against the platform's code on Sep 23, 2026

Walk-forward validation tests an investment strategy in time order: it is fitted only on data before a cut-off, tested on the unseen period that follows, and the cut-off then moves forward and the process repeats — so every test result comes from a period the model had not seen.

Why it matters

Ordinary cross-validation shuffles time, letting a model learn from the future of the period it is tested on. In markets that inflates results, because returns overlap and regimes persist.

How it works

In an anchored (expanding) walk-forward, each training window starts at the beginning of the history and grows; in a rolling one it slides. A purge removes training days whose outcome window overlaps the test period, and an embargo adds a further gap.

Anchored walk-forward, five folds
Fold 1Fold 2Fold 3Fold 4Fold 5
Each row is a fold. Pale: the training window, which grows. Dashed: the purge and embargo gap. Solid: the test period.

Questions

Why not use ordinary k-fold cross-validation for trading strategies?
Because it trains on data from after the test period and ignores overlapping returns, which leaks information and flatters results.
What is the difference between anchored and rolling walk-forward?
Anchored keeps all history in every training window; rolling uses a fixed-length window that moves forward.
What do purge and embargo do?
The purge drops training days whose outcome overlaps the test period; the embargo leaves an extra gap so nearby, correlated days do not leak.

References

  • López de Prado, M. (2018). Advances in Financial Machine Learning. Wiley.

Educational content about research methods. Not investment advice.