Walk-forward analysis

Walk-forward analysis is a backtesting procedure that chooses parameters on a training window, freezes them, evaluates them on the following test window that took no part in the choice, then advances both windows chronologically and repeats. The concatenated test-window results are what the strategy would have returned with parameters it could actually have known at the time.

Senzoukria · Glossary · Updated September 2026


The procedure step by step

  • Fix in advance the training length, the test length, the parameter grid and the selection rule (for example, highest net result after costs).
  • On the first training window, run the grid and pick one configuration by the selection rule.
  • Freeze that configuration and run it on the test window that immediately follows.
  • Slide both windows forward and repeat until the data is exhausted.
  • Report the concatenation of the test windows, each with the configuration chosen for it, including costs and failed trades.

Why it is stronger than one optimisation

A single optimisation over the whole history picks the configuration that fits that history, and its equity curve is then measured on the very data used to pick it. Walk-forward separates the two acts: selection happens on the past, measurement on the future relative to it. Parameters that only fit noise tend to be chosen on one slice and fail on the next, and that failure shows up in the concatenated result instead of being hidden.

The comparison between in-sample and out-of-sample performance across slices is often summarised as walk-forward efficiency: how much of the training-window result survives in the test windows. It is a diagnostic, not a certificate.

Choices that shape the result

Parameters of the procedure itself
ChoiceTrade-off
Number of slicesMore slices give more out-of-sample windows but shorter training periods
Training shareA larger share fits better and tests less; a smaller share tests more on thinner fits
Anchored vs rolling trainingAnchored windows grow from a fixed start; rolling windows keep a fixed length and forget old data
Selection ruleMust be fixed before the run; changing it after seeing results reintroduces selection bias

In Senzoukria

The Automatic backtest panel on the Replay screen has a toggle labelled Walk-forward — find the best configuration. Its hint states the method: parameters are chosen on the start of each slice, then evaluated on the end, which took no part in the choice, and the result shown is the concatenation of those never-seen pieces. The Slices count and Training share are set in the panel, and Parameters to sweep defines the grid; the panel estimates the number of combinations times slices and the expected duration before you press Run the walk-forward.

The report lists each slice with its Training period, its Real test period and the Config chosen, and states a Walk-forward efficiency with a one-line reading: the strategy holds up outside its own data, it loses a good part of its edge out of sample, or most of the result was overfitting. An In-sample vs out-of-sample chart draws the curve the optimiser saw against the one you would actually have had.

Common mistakes

  • Re-running the walk-forward with a different selection rule until the efficiency looks good.
  • Reading the in-sample curve as the result.
  • Using slices so short that each test window holds a handful of trades.
  • Treating the final test window as untouched after decisions were already tuned to it.

This page in other languages

Frequently asked questions

How is walk-forward different from a train/test split?
A single split holds out one later period once. Walk-forward repeats the split many times along the history, so the strategy is evaluated on several periods it never saw, each with parameters chosen just before it. That yields more out-of-sample evidence from the same data and shows whether the chosen parameters drift from slice to slice.
What is walk-forward efficiency?
It compares the performance obtained in the test windows with the performance obtained in the training windows that chose the parameters. A strategy whose out-of-sample result keeps most of its in-sample result is said to hold up; one that keeps little is mostly fitting noise. The figure depends on the slicing and the selection rule, so it is read alongside them.
Does walk-forward prevent overfitting?
It exposes overfitting rather than preventing it. If the analyst keeps changing the grid, the slices or the selection rule after seeing the out-of-sample result, those windows become training data by another name. The procedure works when its own settings are fixed before the run and every run is recorded.

Keep reading