Skip to main content
Blog home
Newsletter
News
Video
Podcast
Reading list
Wright Brief
Sign In

What is Walk-Forward Testing?

A plain-language explanation of Walk-Forward Testing, with a worked example, common pitfalls and the questions people ask most.

Listen to this article
Audio · ~2 min
Add as a preferred source on Google

Walk-forward testing designs a strategy on one window of past data, tests it on the period right after, then rolls both windows forward and repeats. It produces a chain of out-of-sample results that mimics how the strategy would have been used.

How it works

  1. Choose a training window and a test window, for example 5 years and 1 year.
  2. Fit the model on the training window.
  3. Record its results on the following test window, using no information from it.
  4. Move both windows forward by the test length and repeat until the data runs out.

The combined test results form a single out-of-sample record.

An illustrative example

StepTrained onTested on
1Years 1 to 5Year 6
2Years 2 to 6Year 7
3Years 3 to 7Year 8
4Years 4 to 8Year 9
5Years 5 to 9Year 10

This is a rolling window. An anchored (expanding) version keeps year 1 as the start of every training window, so the training set grows. Ten years of data give five separate test years here. The setup is illustrative.

Why it helps

A single split into in-sample and out-of-sample data gives one test. Walk-forward testing gives several, shows whether performance is stable across periods and mimics periodic re-fitting. See out-of-sample testing.

Pitfalls

  • Choosing the windows after seeing results. Trying many window lengths and keeping the best brings back overfitting.
  • Leakage. Returns that overlap the boundary between training and test windows let the test see the training period. A gap between them reduces this.
  • Short test windows. One year of monthly data is only 12 observations, which is a weak test.
  • Costs. Re-fitting too often adds turnover. See portfolio turnover.

Frequently asked questions

What is walk-forward testing?

It is a testing method that repeatedly trains a model on a window of past data and tests it on the period immediately after, rolling forward through time.

What is the difference between a rolling and an anchored walk-forward test?

A rolling test keeps the training window the same length and slides it forward. An anchored test keeps the same start date, so the training window keeps growing.

How is walk-forward testing different from a simple out-of-sample test?

A simple test uses one split. Walk-forward testing uses many splits in sequence, which shows whether performance holds up across different periods.

Does walk-forward testing prevent overfitting?

It reduces it, but a researcher who adjusts the setup after seeing the results can still overfit to the walk-forward record.

Further reading

  1. Lopez de Prado, M. (2018). Advances in Financial Machine Learning. Wiley.
  2. Pardo, R. (2008). The Evaluation and Optimization of Trading Strategies, 2nd ed. Wiley.
Browse the full Quant Glossary →

Disclaimer: Investment in securities market are subject to market risks. Read all the related documents carefully before investing. Registration granted by SEBI, membership of a SEBI recognized supervisory body (if any) and certification from NISM in no way guarantee performance of the intermediary or provide any assurance of returns to investors.

The content in these posts/articles is for informational and educational purposes only and should not be construed as professional financial advice and nor to be construed as an offer to buy/sell or the solicitation of an offer to buy/sell any security or financial products. Users must make their own investment decisions based on their specific investment objective and financial position and using such independent advisors as they believe necessary.

Wryght Research & Capital Pvt (Brand name: Wright Research) is a SEBI Registered Portfolio Manager Reg No: INP000007979 (Validity: Apr 03, 2023 – Perpetual) and a SEBI Registered Research Analyst No: INH000017295 (Validity: Jul 03, 2024 – Perpetual), with its registered office at 103, Shagun Vatika Prag Narayan Road, Lucknow, UP, 226001 India and CIN: U67100UP2019PTC123244. Past performance may or may not be sustained in future. Performance provided there in is not verified by SEBI. Investment in securities is subject to market and other risks, and there is no assurance or guarantee that the objectives of any of the strategies of the Portfolio Management Services will be achieved. Registration granted by SEBI, enlistment as RA with Exchange and certification from National Institute of Securities Markets (NISM) in no way guarantee performance of the intermediary or provide any assurance of returns to investors. Please read the Disclosure document carefully before investing. Securities quoted are for illustration only and are not recommendatory. Charts shown are for illustration only. For more information and disclosures, visit our disclosures page here.

Found this useful? Share it.
Wright PMS · Portfolio Management Service

Put this research to work

The same 300+ factor research engine behind this article — applied to a professionally managed portfolio, end to end.

300+
Factors tracked
2L+
Investors
₹1,200+ Cr
Invested
SEBI
Registered PMS