CFDs and forex are complex instruments and come with a high risk of losing money rapidly due to leverage. Risk disclosure

Walk-forward analysis

This page defines walk-forward analysis, walks through a hypothetical example and shows where the term appears in platforms and reports.

Extrade Pakistan editorial team ·

On this page
  1. What is walk-forward analysis
  2. Formal definition
  3. Worked example (hypothetical)
  4. Where you see the term
  5. Edge cases and limits
  6. Related terms
  7. Frequent questions

What is walk-forward analysis

Walk-forward analysis is a way to test a trading strategy: you optimise its settings on one stretch of past data, test those settings on the next stretch the optimiser never saw, then move both windows forward and repeat.

You will also see it called walk-forward testing or walk-forward optimization. Its purpose is to check whether a strategy still works on data it was not tuned on, rather than only on the history it was fitted to.

Past data (tuned)New datastart
Over-fitting: a strategy tuned to past data looks smooth on that data and often fails on data it has not seen. Test on a separate period and on a demo first. Illustrative example: made-up numbers for learning, not real prices or a broker's conditions.

Formal definition

Walk-forward analysis is a sequence of paired segments taken in time order:

After each pair, both windows shift forward, usually by the length of the OOS window. The OOS segments are then joined into one out-of-sample equity curve. That joined curve, not the in-sample result, is the estimate of how the strategy might have behaved.

There are two common variants:

Worked example (hypothetical)

A trader tests a moving-average crossover on EUR/USD. The parameters are the lengths of the fast and slow averages.

  1. Take the earliest block of history as the IS window. Run an optimisation and pick the parameter pair with the best result.
  2. Apply that pair, without changes, to the following shorter block. This is the OOS window. Record the trades.
  3. Shift both windows forward by the length of the OOS block. Optimise again on the new IS window and test on the new OOS window.
  4. Repeat until the data runs out. Then join all the OOS results.

Suppose the in-sample results look strong but the joined out-of-sample curve is flat or falling. That usually points to overfitting: the settings matched past noise rather than a pattern that repeats. Some testers summarise this gap as walk-forward efficiency, which compares out-of-sample performance with in-sample performance.

Where you see the term

Edge cases and limits

A good walk-forward result does not predict future profit. Leveraged forex and CFD trading can lose money fast. See risk management.

Trading strategies · Technical analysis · Equity curve · Correlation coefficient · Trading glossary

Frequent questions

What is the difference between backtesting and walk-forward testing?

A backtest usually optimises and measures on the same data. Walk-forward testing always measures on data that comes after the optimisation period and was not used in it.

Is walk-forward optimization the same as walk-forward analysis?

In practice, yes. Both names describe the repeated cycle of optimising on one window and testing on the next.

Rolling or anchored: which is used?

Both are used. Rolling windows adapt faster to recent behaviour. Anchored windows use more data but react more slowly.

Can I practise this without real money?

Yes. You can run tests in the platform's strategy tester and then watch the strategy forward on a demo account. Neither shows how live trading will turn out.

Related pages