# 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.

Source: https://learn.tradelabsai.com/research/walk-forward-analysis/  
Track: Research and Backtesting · Level: Intermediate · Updated: 2026-10-03  
Publisher: TradeLabs AI (https://tradelabsai.com). Education, not financial advice.  
Cite as: TradeLabs Learn, "Walk-Forward Analysis", https://learn.tradelabsai.com/research/walk-forward-analysis/

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.

| 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](https://learn.tradelabsai.com/math/rolling-and-expanding-windows/).

## Walk forward efficiency

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

**Example: Interpreting a walk forward test**
A trend strategy's walk forward test over 12 years shows average in sample annual returns of 22% and stitched out of sample annual returns of 9%. Walk forward efficiency is about 41%. Parameters chosen in each window varied widely, from 20 to 120 days. The large drop and unstable parameters suggest the in sample optimisation was mostly fitting noise. A version with a fixed, reasonable parameter performed similarly out of sample with less complexity, so the trader keeps it simple. Some practitioners treat efficiency above about 50% to 60% as encouraging, but there is no universal threshold. See [Parameter Optimization](https://learn.tradelabsai.com/research/parameter-optimization/).

## 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](https://learn.tradelabsai.com/math/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](https://learn.tradelabsai.com/machine-learning/walk-forward-validation/).

## 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](https://learn.tradelabsai.com/research/overfitting-and-curve-fitting/).

## Continue learning

- Next lesson: [Overfitting and Curve Fitting](https://learn.tradelabsai.com/research/overfitting-and-curve-fitting/)
- Previous lesson: [In-Sample vs Out-of-Sample Testing](https://learn.tradelabsai.com/research/out-of-sample-testing/)
- Related: [In-Sample vs Out-of-Sample Testing](https://learn.tradelabsai.com/research/out-of-sample-testing/): Out of sample testing checks a strategy on data not used to build it. Learn train, validation and holdout splits, common mistakes and how to read results.
- Related: [Parameter Optimization](https://learn.tradelabsai.com/research/parameter-optimization/): Choosing strategy parameters by optimisation risks overfitting. Learn grid and random search, robustness surfaces, walk forward optimisation and sensible defaults.
- Related: [Walk-Forward Validation and Preventing Overfitting](https://learn.tradelabsai.com/machine-learning/walk-forward-validation/): Walk forward validation retrains a model on a rolling or expanding window and tests it on the next period, just as it would be used live. Learn setup and choices.
- Related: [Rolling and Expanding Windows](https://learn.tradelabsai.com/math/rolling-and-expanding-windows/): Rolling windows use a fixed recent period; expanding windows use all data so far. Learn when to use each, window length trade offs and how to avoid look ahead bias.
- Related: [Overfitting and Curve Fitting](https://learn.tradelabsai.com/research/overfitting-and-curve-fitting/): Overfitting 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.
