Free trial
Menu
Learn guide

Evaluate Strategies with Walk-Forward Testing

Walk-forward testing checks whether a strategy's settings still work on data they were not chosen on. You optimise the settings on one period, test them on the period that follows, then roll both windows forward and repeat. It is the most direct way to find out whether a good backtest comes from rules that hold up or from settings fitted to the past.

QuantPower Research · Updated 3 Nov 2026 · 4 min read

Key point
A normal backtest picks the best settings using all the data, so it always looks better than live trading will. Walk-forward testing only ever judges settings on data that came after they were chosen, as live trading does.

Why a single backtest is not enough

When you try many settings on the same data and keep the best, part of the result is luck. The more settings you try, the more likely the winner simply fitted the noise in that period. This is overfitting, and it is the main reason strategies that backtest well disappoint when they go live.

Walk-forward testing separates the two jobs:

  • In-sample period: the data used to choose the settings.
  • Out-of-sample period: the data used to judge them, which the optimisation never saw.

How walk-forward testing works

  1. Choose the windows. For example, 12 months to optimise and the following 3 months to test.
  2. Optimise on the first in-sample window. Run the backtest with each candidate setting and keep the best by your chosen measure, such as return per unit of drawdown.
  3. Test on the next out-of-sample window. Run the chosen setting, unchanged, on the following 3 months and record the result.
  4. Roll forward. Move both windows on by 3 months and repeat.
  5. Join the test periods. The out-of-sample results, joined end to end, are your walk-forward result.

You can do this in any backtester that lets you set the date range, including QuantPower's backtesting: run each in-sample window, note the best setting, then run that setting on the window that follows.

Rolling and anchored windows

TypeIn-sample windowSuits
RollingFixed length that moves forward, such as the last 12 monthsMarkets whose behaviour changes, such as index options after rule changes
AnchoredStarts at the same date and grows each stepStrategies that need as much history as possible

Rolling windows adapt faster. Anchored windows give more stable settings but react slowly when the market changes.

Example: a Nifty short straddle stop loss

This hypothetical test chooses the stop loss for a Nifty short straddle, between 20% and 40% of the premium collected, using 12-month in-sample windows and 3-month out-of-sample windows.

WindowOptimise onTest onChosen stop lossOptimised return (annualised)Test return (annualised)
1Jan–Dec 2021Jan–Mar 202225%18%12%
2Apr 2021–Mar 2022Apr–Jun 202230%16%9%
3Jul 2021–Jun 2022Jul–Sep 202230%17%11%
4Oct 2021–Sep 2022Oct–Dec 202225%19%−2%
5Jan–Dec 2022Jan–Mar 202335%15%10%

The optimised windows average 17% a year, but the test windows average 8%. Live trading would most likely look like the second figure.

Five walk-forward windows of 12 months optimised and 3 months tested, with the chosen stop loss and returns of each (illustration)

Walk-forward efficiency

Formula
Walk-forward efficiency = average out-of-sample return ÷ average in-sample return

In the example, 8% ÷ 17% gives an efficiency of about 47%. Many traders treat an efficiency above about 50% as a sign that the rules hold up on new data. A much lower figure suggests the optimisation is mostly fitting noise.

Also look at:

  • Stability of the chosen settings. If the best stop loss jumps between 20% and 40% from one window to the next, the strategy is sensitive to the setting.
  • Losing test windows. One losing quarter out of five, as in window 4, is normal. Several in a row are a warning.
  • Drawdown in the test periods, compared with what you can afford.

Choosing window lengths

  • The in-sample window should contain enough trades for the result to mean something. Many traders aim for at least 30 to 50 trades in each window.
  • The out-of-sample window is usually a quarter to a third of the in-sample length.
  • Rule changes mark natural break points. For index options, results from before November 2024, when Bank Nifty still had weekly expiries, may not describe today's market. See SEBI's rules for option trading.

Common mistakes

  • Changing the rules after seeing the test results. Each change uses up the out-of-sample data, which then stops being out of sample.
  • Optimising too many settings at once. Every extra setting multiplies the combinations tried and the chance of fitting noise.
  • Ignoring costs. Include brokerage, STT and slippage in every window. Our STT tax calculator shows what a trade costs.
  • Leaking future data. A signal that uses information not yet available at the time of the trade inflates every window. See look-ahead bias.

After walk-forward testing

A walk-forward test is still a test on the past. Before going live, run the strategy in paper trading for a few weeks to check fills and timing, then start with small size and a daily loss limit such as an MTM stop loss.

Start your free trial

Connect your broker, build a strategy and test it on paper before a single live order goes out.

Frequently asked questions

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

A backtest runs a strategy on past data, often with settings chosen on that same data. Walk-forward testing chooses the settings on one period and judges them only on the period that follows, repeated across the history.

How many walk-forward windows do I need?

Enough to cover different market conditions. Five or more out-of-sample windows across rising, falling and sideways markets is a reasonable minimum.

What is a good walk-forward efficiency?

Many traders look for an efficiency above about 50%. The stability of the chosen settings and the drawdowns in the test windows matter as much as the single figure.

Is walk-forward testing the same as forward testing?

No. Walk-forward testing uses historical data. Forward testing, or paper trading, runs the strategy on live prices as they happen.

Sources

  • SEBI, measures to strengthen the equity index derivatives framework, 1 October 2024, and circular on expiry days, 26 May 2025
  • NSE, schedule of STT, exchange transaction charges, SEBI turnover fee and stamp duty; Finance Act, 2026 (STT rates from 1 April 2026)
The example is hypothetical and for illustration only. Past and backtested results do not guarantee future results. Trading involves substantial risk.