← All lessons

Walk-forward

Re-fit on a rolling window and count only what comes after it. · 8 min

ProOpen to everyone while Pro is in preview.

A single holdout is used once. Walk-forward analysis repeats the in-sample/out-of-sample split through time, the way you would really run a strategy: re-fit on recent history, trade the next stretch, slide forward, re-fit.

Predict first

Walk-forward on the trending market: two years to choose a moving-average pair, six months to trade it, fourteen times. Will the out-of-sample Sharpe be close to the in-sample one?

Walk-forward

Choose the best moving-average pair on a training window, trade it on the next test window, slide forward, repeat. Only test windows count.

Running the numbers…

Reading a walk-forward report

  • Out-of-sample Sharpe: the headline. Every day in it was traded with settings chosen before that day.
  • Walk-forward efficiency: out-of-sample performance as a share of in-sample. Davey suggests looking for well above half.
  • Parameter stability: if the chosen pair jumps around from window to window, the optimisation is chasing noise.

Worked example

2,520 days, a 200-day warm-up for the slowest average, train 504, test 126:

  • Window 1: train days 200 to 703, test 704 to 829.
  • Window 2: train 326 to 829, test 830 to 955. Each window slides by the test length.
  • Windows that fit: ⌊(2,519 − 200 − 504) ÷ 126⌋ = 14, covering 1,764 out-of-sample days.

Common mistake

Optimising the walk-forward itself. Trying many window lengths and reporting the best one is data snooping one level up. Choose the windows from how often you would really re-fit, before you run it.

A walk-forward picks MA 5/20, then 50/200, then 10/150, then 30/50 in successive windows. What does that suggest?
What does a walk-forward efficiency of 25% mean?

Closing round

Pick the honest result

Four results from the same no-edge market, reported the way a strategy seller might. Only one is a fair estimate of what trading it would earn.

Simulated data from the course’s market engine, not real prices. On this market the true Sharpe of every rule is zero.

Building a fresh case…

Further reading: Davey, Building Winning Algorithmic Trading Systems (walk-forward analysis).