Walk-Forward AnalysisWFA

Walk-forward analysis tests a strategy by repeatedly optimising it on one period and then testing it on the following, unseen period, rolling forward through the data. It gives a more honest estimate than a single optimisation over all the data.

A strategy that looks perfect on old data may simply be fitted to that data. Walk-forward analysis guards against this by tuning a strategy on one window, testing it on the next unseen window, then rolling forward and repeating.

Category
Trading Psychology and Performance
Reading time
3 min
Also called
Walk-forward testing, Walk-forward optimisation, Rolling-window backtest
Updated

Walk-forward analysis in plain words

In a walk-forward (rolling-window) test, you fit the signals on one window, trade the next period, roll the window on, rebalance, and track results over time.1

Testing on data the system never saw is how you catch over-optimisation.2

Because it mimics real investing step by step, rolling-window testing is a closer stand-in for live trading.1

How to run a walk-forward analysis

  1. Split the data

    Divide history into repeating in-sample and out-of-sample windows.

  2. Optimise in-sample

    Tune settings on the first window only.

  3. Test out-of-sample

    Run the tuned rules on the next unseen window.

  4. Roll forward

    This is also called a rolling-window framework.1

  5. Join the results

    Combine the out-of-sample windows to judge Expectancy and Drawdown.

  6. Forward test

    Next, forward-test the system on a demo account.2

Worked examples

Example 1 — Fitted backtest

Curve-fit

A hypothetical strategy shows a strong in-sample Profit Factor but fails out-of-sample.

Example 1 — Fitted backtest — calculation
In-sample result+40R
Out-of-sample result−6R

Rules tuned too tightly to the past often break when live markets behave differently.2

Example 2 — Stable rules

Robust

A hypothetical strategy keeps similar results across five out-of-sample windows.

Example 2 — Stable rules — calculation
Windows positive4 of 5
Average per window+3R

Checking on unseen data gave more confidence that the rules weren't over-fitted.2

Example 3 — Too good to be true

Sceptical check

A hypothetical out-of-sample result looks far better than in-sample.

Example 3 — Too good to be true — calculation
Out-of-sample result+60R
ActionRe-check for errors

Results that look too good usually mean curve-fitting, not a real edge.2

Walk-forward vs single backtest

AspectWalk-forwardSingle backtest
Data useRepeated in/out-of-sample windowsOne period
Overfitting checkBuilt inWeak
EffortHigherLower
RealismCloser to live tradingOften optimistic

Where walk-forward analysis is used

Advantages and disadvantages

Advantages

  • Tests rules on unseen data.
  • Exposes curve-fitting.
  • Mimics how a strategy is used live.
  • Gives several results, not one.

Disadvantages

  • Needs a lot of data.
  • Takes more time to run.
  • Window lengths are a choice that can itself be fitted.
  • Still uses past data only.

Going deeper

Read as far as you need. Each level builds on the one before it.

What it is

Beginner

Walk-forward testing repeatedly fits on a rolling window, trades the following stretch, and stitches the results together.1

Biases to watch

Intermediate

Behavioural traps still apply, including survivorship bias and look-ahead bias.1

Why it matters

Advanced

One well-known paper argues that most published findings in financial economics are probably false.3

Common mistakes

  1. Peeking ahead

    Using out-of-sample data while tuning.

  2. Too few windows

    One test proves little.

  3. Re-tuning until it passes

    That is curve-fitting again.

  4. Ignoring costs

    Add Slippage and fees to every window.

Check your understanding

Test yourself before moving on. Each answer comes with an explanation.

Q1What is the out-of-sample window used for?
Q2What should you be sceptical of?

Key points to remember

  1. Walk-forward analysis tunes on one window and tests on the next.
  2. It then rolls forward and repeats.
  3. It helps expose curve-fitting.
  4. Watch for look-ahead and survivorship bias.
  5. Forward test before trading live.

Frequently asked questions

How long should each window be?

Long enough to hold many trades; choose it before testing.

Does a good walk-forward guarantee results?

No. It only shows the rules held up on past unseen data.

Is it the same as forward testing?

No. Forward testing runs on new live data, often on a demo account.

Further learning

Sources

This article is written in our own words. The sources below support the specific facts, rules and figures marked with a number in the text. Links open the original publisher’s page.

  1. CFA Institute. Backtesting and Simulation (opens in a new tab) Checked .
  2. CMC Markets. FX trading systems guide for building your strategy (opens in a new tab) Checked .
  3. NBER. ... and the Cross-Section of Expected Returns (Working Paper 20592) (opens in a new tab) Checked .

Educational content, not financial advice. Examples use hypothetical prices and simplified costs; actual fees, margin rules and regulations vary by broker, market and country. We are not affiliated with any publisher linked above. Last reviewed . Report an error or request a source credit.