TradeLabs AILearn

Walk-Forward Analysis

Walk forward analysis repeatedly optimises a strategy on past data and tests it on the next period. Learn how it works, window choices, efficiency ratios and limits.

Intermediate3 min readUpdated 3 Oct 2026
Markdown
Lesson 7 of 38

A single out of sample test gives one estimate of how a strategy performs on unseen data. Walk forward analysis gives many. It optimises the strategy on a window of past data, tests it on the following period, then rolls the window forward and repeats. Stitching together all the test periods produces an out of sample track record that mimics how the strategy would have been re optimised and traded in real time. Robert Pardo popularised the method for trading systems in the 1990s.

How it works#

  1. Choose an in sample window, such as 3 years.
  2. Choose an out of sample window, such as 6 months.
  3. Optimise parameters on the first in sample window.
  4. Test those parameters on the next out of sample window and record results.
  5. Roll forward by the out of sample length and repeat.
  6. Combine all out of sample periods into one equity curve.
RunOptimise onTest on
12010 to 2012First half of 2013
2Mid 2010 to mid 2013Second half of 2013
32011 to 2013First half of 2014
.........

Rolling vs anchored#

TypeIn sample windowEffect
RollingFixed length, moves forwardAdapts to recent conditions
Anchored (expanding)Starts at a fixed date and growsUses more data; more stable

See Rolling and Expanding Windows.

Walk forward efficiency#

walk forward efficiency = annualised out of sample return / annualised in sample return

What to look for#

  • Positive, consistent out of sample results across many windows.
  • Stable parameters from one window to the next.
  • Reasonable walk forward efficiency.
  • Performance across different regimes within the test. See Structural Breaks and Regime Changes.
  • Enough trades in each out of sample window to be meaningful.

Choosing window lengths#

ConsiderationGuidance
In sample lengthLong enough to include many trades and varied conditions
Out of sample lengthLong enough to evaluate; short enough for many runs
RatioOften 3:1 to 5:1 in sample to out of sample
Strategy horizonSlower strategies need longer windows

Window choices themselves are parameters: testing many window lengths and choosing the best reintroduces overfitting.

Limits#

  • Still uses one history: walk forward tests cannot create independent data.
  • Data snooping: researchers often run walk forward tests many times while designing the strategy.
  • Computational cost for complex strategies.
  • Regime shifts between windows can make re optimisation chase the past.

Walk forward in machine learning#

Machine learning researchers use similar methods, called walk forward validation, to train models on past data and predict the next period, avoiding look ahead bias. See Walk-Forward Validation and Preventing Overfitting.

Frequently asked questions#

What is walk forward analysis?#

A testing method that repeatedly optimises a strategy on a past window and tests it on the following period, rolling forward through history.

What is walk forward efficiency?#

The ratio of out of sample returns to in sample returns, used as a rough measure of how much optimised performance carries over to unseen data.

What is the difference between rolling and anchored walk forward?#

Rolling uses a fixed length window that moves forward; anchored keeps a fixed start date and grows the window over time.

Next, learn the main enemy of backtests in Overfitting and Curve Fitting.

Check your understanding

3 quick questions on this lesson. Get them all right to finish it.

Turn on JavaScript to take the quiz.

Finished this lesson?Sign in to save your progress across devices.
Next lessonOverfitting and Curve FittingOverfitting means a strategy fits noise instead of a real pattern. Learn the warning signs, why it happens, how to measure it and practical ways to avoid it.

Mentioned in