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.
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#
- Choose an in sample window, such as 3 years.
- Choose an out of sample window, such as 6 months.
- Optimise parameters on the first in sample window.
- Test those parameters on the next out of sample window and record results.
- Roll forward by the out of sample length and repeat.
- Combine all out of sample periods into one equity curve.
| Run | Optimise on | Test on |
|---|---|---|
| 1 | 2010 to 2012 | First half of 2013 |
| 2 | Mid 2010 to mid 2013 | Second half of 2013 |
| 3 | 2011 to 2013 | First half of 2014 |
| ... | ... | ... |
Rolling vs anchored#
| Type | In sample window | Effect |
|---|---|---|
| Rolling | Fixed length, moves forward | Adapts to recent conditions |
| Anchored (expanding) | Starts at a fixed date and grows | Uses 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#
| Consideration | Guidance |
|---|---|
| In sample length | Long enough to include many trades and varied conditions |
| Out of sample length | Long enough to evaluate; short enough for many runs |
| Ratio | Often 3:1 to 5:1 in sample to out of sample |
| Strategy horizon | Slower 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.
3 quick questions on this lesson. Get them all right to finish it.
Turn on JavaScript to take the quiz.
Mentioned in
- The Trading Research ProcessResearch and Backtesting
- Why Strategies FailResearch and Backtesting
- Quant Trading Learning PathStart Here
- Statistical Power and Type I and II ErrorsMath and Statistics
- OptimizationMath and Statistics
- Developing, Testing and Monitoring AlgorithmsAlgorithmic Trading