# Walk-forward

Also written walk forward, walk-forward optimisation, walk-forward analysis.

*https://stockmarketstack.com/glossary/walk-forward · next to Backtesting Frameworks & Algo Trading Libraries*

**Definition:** A procedure for measuring a rule on data that was not used to choose it: select on an in-sample window, measure on the out-of-sample window that follows, then step both windows forward and repeat, stitching the out-of-sample segments into one record. It tests a selection procedure rather than one fixed set of parameters, and it inherits every defect of the data underneath it.

## How it works

The mechanism is a sliding pair of windows over one time series.

Take a sample of history and cut it into two adjacent windows. The first — in-sample, sometimes
called the training or optimisation window — is where a choice is made: a parameter fitted, a model
estimated, one candidate rule picked out of many. The second, out-of-sample, is where the chosen
thing is then measured, on rows that were not visible when the choice was made. Then both windows
move forward by a step, usually the length of the out-of-sample window, and the whole thing repeats.
The out-of-sample segments are laid end to end and read as one record.

Three knobs define any particular run, and they are worth naming because they are what makes two
walk-forward results incomparable:

**Anchored or rolling.** An anchored (expanding) window keeps the start date fixed, so the in-sample
period grows at every step and the last fit sees all of history. A rolling window keeps the
in-sample length constant and discards the oldest data at each step, so every fit sees the same
amount of history but a different part of it. They answer different questions and they are not
variants of each other.

**The window lengths and the step.** These fix how many folds exist. Fewer, longer segments give
each measurement more data and give you fewer of them; more, shorter segments give the opposite.
Either way the total is one history, sliced.

**What is carried across the boundary.** Whether the chosen parameters persist until the next
re-selection, whether positions are held open across the seam, and whether the equity curve is
continuous or each segment restarts are implementation details that change the stitched number.

## What the procedure can and cannot tell you

It can tell you whether a *selection procedure*, applied repeatedly, would have produced results on
rows it had not seen. That is a strictly stronger statement than a single backtest over a whole
sample, where the rule and the measurement share every row.

It cannot turn a simulation into evidence about the future, and the performance standards this
industry uses are blunt about the category. The GIPS standards define theoretical performance as
performance not derived from actual assets invested in the strategy presented, and list backtested
and hypothetical performance inside that definition; a firm claiming compliance must not link
actual performance to historical theoretical performance, and where theoretical performance appears
at all it must be labelled supplemental information and accompanied by a description of the
methodology and assumptions used to produce it. The methodology and the assumptions are the
disclosure — which is exactly what a stitched equity curve with no accompanying description of its
windows omits.

It also cannot see its own reuse. The same history is walked once per configuration you try, and
nothing in the procedure counts how many configurations that was.

## The data underneath decides what is being measured

This is the honest core of the term, and it is upstream of every implementation detail above.

A walk-forward run over a universe of securities that still exist today is not measuring a rule. It
is measuring a dataset in which nothing ever failed, because the companies that were acquired, went
to zero or dropped out of an index are absent along with their returns — see
[survivorship bias](https://stockmarketstack.com/glossary/survivorship-bias). Databases built to keep those securities exist
precisely because the question cannot be answered without them: CRSP's US stock databases carry the
securities that stopped trading, with their delisting information attached. Similarly, a run that
uses figures as they stand today rather than as they stood on each date inside the window has leaked
the future into the in-sample choice, which is what [point-in-time](https://stockmarketstack.com/glossary/point-in-time) data
prevents. A restated figure is the more accurate description of a period and was not available
during it; a procedure built on the premise that a choice only saw the past is void if the rows it
saw were revised afterwards.

## Why it matters here

The feature appears across
[backtesting frameworks](https://stockmarketstack.com/categories/backtesting-frameworks) and it is usually sold as a robustness
suite rather than a split. [StrategyQuant X](https://stockmarketstack.com/tools/strategyquant-x) puts walk-forward optimisation
and a Walk-Forward Matrix alongside Monte Carlo and parameter permutation, and its own
documentation says that only a small fraction of generated candidates survive the battery.
[AmiBroker](https://stockmarketstack.com/tools/amibroker) and [Wealth-Lab](https://stockmarketstack.com/tools/wealthlab) fold it into the optimiser, the
latter with parameter-stability surfaces; [QuantRocket](https://stockmarketstack.com/tools/quantrocket) applies it to
scikit-learn, Keras and XGBoost models; [Build Alpha](https://stockmarketstack.com/tools/build-alpha) sits in the same generate
and filter tradition.

Reading any of those outputs, the thing to establish first is not the number but the arrangement:
anchored or rolling, which windows, and — before either — whether the universe the run walked
through contains the securities that stopped trading. A tidy stitched curve over a survivor-only
universe is a well-executed measurement of the wrong thing.

## Where you will meet this

- [QuantRocket](https://stockmarketstack.com/tools/quantrocket.md)
- [StrategyQuant X](https://stockmarketstack.com/tools/strategyquant-x.md)
- [AmiBroker](https://stockmarketstack.com/tools/amibroker.md)
- [WealthLab](https://stockmarketstack.com/tools/wealthlab.md)
- [Build Alpha](https://stockmarketstack.com/tools/build-alpha.md)
- [MotiveWave](https://stockmarketstack.com/tools/motivewave.md)
- [MultiCharts](https://stockmarketstack.com/tools/multicharts.md)
- [NinjaTrader](https://stockmarketstack.com/tools/ninjatrader.md)
- [PortfoliosLab](https://stockmarketstack.com/tools/portfolioslab.md)
- [skfolio](https://stockmarketstack.com/tools/skfolio.md)
- [tradingview-mcp](https://stockmarketstack.com/tools/tradingview-mcp.md)
- [Vibe-Trading](https://stockmarketstack.com/tools/vibe-trading.md)

## FAQ

### Is a walk-forward result an out-of-sample result?

Only on the first pass. Each segment is out-of-sample with respect to the window that preceded it, which is the property the procedure is built to have. But once you have read the stitched record and changed something because of what you saw, the whole history has been used to make a choice and nothing in it is out-of-sample any more. The count of times you looked is part of the result.

### Does a walk-forward test correct for bad data?

No, and it cannot. The procedure only controls which rows a choice was allowed to see; it has no way to add rows that are missing or to undo a restatement. Run over a universe of companies that still exist, it measures the universe. That is a property of the dataset and has to be fixed there.

## Sources

1. [Global Investment Performance Standards (GIPS) for Firms, 2020 edition](https://www.gipsstandards.org/wp-content/uploads/2021/03/2020_gips_standards_firms.pdf) — CFA Institute, 2020-01-01. The current edition — it took effect on 1 January 2020 and CFA Institute has published no successor edition.
2. [CRSP US Stock Databases](https://indexes.morningstar.com/research-data-products/crsp-us-stock-databases) — Morningstar Indexes (CRSP), read 2026-09-14

*Last updated 2026-09-21. A reference page, corrected in place — not a dated post.*
