TL;DR: Walk forward analysis splits history into a chain of windows: optimise the strategy on one slice (in-sample), then trade those exact settings on the slice that follows (out-of-sample), roll forward, repeat. Only the out-of-sample results count. If the stitched out-of-sample equity curve keeps at least half the in-sample edge — a walk forward efficiency of 50% or more — the strategy has a real chance. If it collapses, your backtest was describing the past, not an edge. For Indian traders it is the cheapest protection there is against curve-fitting a NIFTY or BANKNIFTY system to one lucky year.


Last updated: 17 September 2026 · 9 min read

By Pulkit Mangal — F&O trader since 2017, founder of TradeDiary. Traded across Zerodha, Kotak and Dhan; built TradeDiary after losing ₹14L in 2021 to mistakes a journal would have caught — including a moving-average system that looked flawless on three years of data and lost money from the week it went live.


The backtest had a 2.4 profit factor. Fast EMA 9, slow EMA 23, a 1.35% stop, only on NIFTY futures, only between 9:45 and 2:30. Every number had been tuned until the equity curve looked like a staircase.

It lost money in its first month live. And its second.

Nothing was wrong with the code. What was wrong was that I had tested 4,800 combinations of those five parameters on the same three years of data and picked the best one. Of course it looked brilliant. I had not found an edge; I had found the combination that best memorised 2019 to 2021.

Walk forward analysis is the test I should have run before risking a rupee. It asks a harder, more honest question than a backtest: if you had optimised this strategy with only the data available at the time, and then traded it on the months that came next, would it have made money?

💡 Short on time? A walk forward test tells you whether an edge is real in history. A journal tells you whether you are capturing it live. Start a free trading journal, import your tradebook, and compare your live expectancy per setup against what your out-of-sample test promised.

What "walk forward analysis" actually means

Walk forward analysis is a rolling sequence of optimise-then-test cycles, where every test is run on data the optimiser never saw.

A normal backtest optimises and evaluates on the same data. Walk forward separates the two:

  1. Take a window of history — say 12 months. This is the in-sample (IS) window. Optimise your parameters here.
  2. Take the next, shorter window — say 3 months. This is the out-of-sample (OOS) window. Trade the parameters you just chose, unchanged. Record the result.
  3. Slide both windows forward by the OOS length and repeat until you run out of data.
  4. Stitch every OOS segment together. That stitched curve is the only performance figure that matters.

The number that summarises it is walk forward efficiency (WFE): annualised OOS return divided by annualised IS return. A WFE of 60% means the strategy kept 60% of its optimised performance on unseen data. Below roughly 50%, most of what the backtest showed was fit to noise.

Three India-specific details change how you set it up:

Why it matters for Indian traders

Because the easiest edge to find is a fake one, and the market here punishes it quickly.

Overfitting is the default, not the exception. Every parameter you tune multiplies the combinations you test. Five parameters with twelve values each is nearly 250,000 backtests; some of them will look extraordinary by chance alone. Walk forward analysis does not stop you optimising — it stops you believing the result until it survives data it never touched.

SEBI's data leaves no room for self-deception. The regulator's January 2024 study of individual F&O traders found that 93% of individual traders lost money between FY22 and FY24. A strategy that only works on the data it was built from is one of the most reliable ways to join that group while feeling confident.

Regimes change faster than backtests assume. The same index has spent long stretches trending, long stretches range-bound and short stretches in violent volatility spikes. A single backtest across all of it averages them into one number that describes none of them. Walk forward windows show you when the strategy worked, which is often more useful than whether it worked on average.

Retail algo access has raised the bar. With broker APIs and exchange-approved algo frameworks making automation accessible to individuals, the simple patterns that used to carry an edge are crowded. What survives tends to be modest and fragile — exactly the kind of edge a proper out-of-sample test can confirm and an over-tuned backtest will exaggerate.

The seven settings that decide whether the test is honest

Setting Why it matters
In-sample window length Too short and the optimiser fits noise; too long and it averages regimes that no longer exist. 6–24 months is typical for daily systems.
Out-of-sample window length Usually 20–35% of the IS window. It must contain enough trades to mean something — aim for 20+ per window.
Anchored or rolling Anchored keeps the IS start fixed and grows it; rolling slides both ends. Rolling adapts faster, anchored is more stable. Pick before you look at results.
Optimisation target Net profit rewards luck. Expectancy per trade, profit factor or return divided by drawdown are harder to game.
Parameter ranges Decide them in advance. Widening a range after a bad OOS result is curve-fitting by another name.
Cost model Full all-in charges for your broker and segment, applied inside the optimiser, not afterwards.
Minimum trades per window A window with 6 trades tells you nothing. Discard or merge windows below your threshold before computing WFE.

Two optional checks make the result sturdier: look at whether the chosen parameters are stable across windows (if the best EMA jumps from 9 to 31 to 14, there is no real optimum), and check whether neighbouring parameter values also perform well (a lone spike surrounded by losers is noise).

How to run a walk forward analysis, step by step

  1. Write the rules and the parameter ranges down first. Entry, exit, stop, position sizing, trading hours — and the exact values each parameter may take. Freeze them.
  2. Choose the windows. For a daily or 15-minute system on NIFTY or BANKNIFTY, a 12-month IS window and 3-month OOS window is a reasonable start. Choose anchored or rolling now, not after.
  3. Build the cost model. Brokerage plus STT, exchange charges, GST, SEBI fees and stamp duty for your segment. Include a realistic slippage figure; the algo trading slippage guide shows how to measure yours.
  4. Optimise on window 1 IS. Pick the best parameter set by your chosen target — not by net profit.
  5. Trade those parameters, untouched, on window 1 OOS. Record trades, not just the total.
  6. Roll forward and repeat until the final OOS window ends at the most recent data.
  7. Stitch the OOS results and compute WFE, plus OOS profit factor, expectancy in R-multiples and maximum drawdown.
  8. Decide with a pre-committed rule. For example: go live only if WFE ≥ 50%, at least 70% of OOS windows are profitable, and OOS max drawdown is within what you can actually sit through.
  9. Go live small, and journal every trade. The live account is the final out-of-sample window, and it is the only one with your emotions in it.

A real example, with numbers

Ananya is 29, a data analyst in Bengaluru, running a ₹4.2 lakh account. She built a NIFTY futures trend system with three parameters and backtested it over four years: profit factor 2.1, expectancy +0.61R per trade. She almost went live on that.

Instead she ran a rolling walk forward: 12-month IS, 3-month OOS, 12 windows, full charges included.

Window set Trades Profit factor Expectancy (R) Profitable windows
In-sample (averaged) 412 2.10 +0.61R 12 of 12
Out-of-sample (stitched) 131 1.31 +0.23R 8 of 12
OOS, expiry-week trades only 47 0.88 −0.09R
OOS, non-expiry weeks 84 1.62 +0.41R

Her walk forward efficiency came out at 38%. On the headline number, the system failed her own 50% rule.

But the breakdown showed where: the strategy's out-of-sample losses were concentrated in expiry weeks, where the index chopped through her stops. Outside them, it kept +0.41R — roughly two-thirds of its in-sample edge. She did not re-optimise the parameters to fix that, which would have been curve-fitting. She added one rule decided on logic rather than results — stand aside in expiry week — and ran the entire walk forward again from scratch. The new WFE was 64%.

She went live with one lot. Four months and 38 trades later, her journal showed +0.36R per trade after charges — below the walk forward estimate, as live results almost always are, but positive and inside the range the test had predicted.

Six mistakes that make walk forward analysis worthless

  1. Peeking at out-of-sample results and then changing the rules. The moment OOS data influences a decision, it becomes in-sample. Any change means re-running everything.
  2. Optimising for net profit. It selects the luckiest run. Optimise for expectancy, profit factor or return-to-drawdown instead.
  3. Windows with too few trades. Twelve OOS windows of eight trades each is noise stitched together. Lengthen the windows or accept fewer of them.
  4. Leaving costs out of the optimiser. Adding charges only at the end lets the optimiser pick high-turnover settings that could never survive them.
  5. Treating a passed test as proof. A good WFE means the edge was not obviously fitted. It does not mean the next regime will cooperate. Size small and keep measuring.
  6. Stopping at the backtest. Walk forward analysis still assumes perfect execution. The gap between its result and your account is execution drift — covered in detail in backtest vs journal — and only a live record reveals it.

How TradeDiary helps

Walk forward analysis ends where live trading begins, and that is exactly where TradeDiary picks up. Run the system as a Forward Test first with paper positions at real prices, then import your broker tradebook once you go live: TradeDiary applies real all-in charges and computes expectancy, profit factor and drawdown per setup, so you can check the live numbers against your out-of-sample estimate every month instead of guessing. For the full picture of which metrics to track, see Trader Analytics 101. Start free — import your trades and compare live results against your walk forward test.

You may also like: Backtest vs journal · Algo trading performance review · Algo trading slippage · What a trading edge actually is

Frequently asked questions

What is a good walk forward efficiency? Above 50% is the common threshold, and 60–80% is strong. Treat anything close to or above 100% with suspicion rather than delight: out-of-sample periods rarely beat the in-sample optimisation, so a very high figure usually means too few trades or a lucky window rather than a remarkably robust system.

How is walk forward analysis different from a normal backtest? A normal backtest optimises and measures performance on the same data, which rewards whatever happened to fit that history. Walk forward analysis only counts results from periods the optimiser never saw, and it repeats that across many windows, so it tests whether the process of choosing parameters works — not whether one parameter set got lucky.

Should I use anchored or rolling windows? Rolling windows drop old data, so the strategy adapts to recent market behaviour; they suit systems you expect to re-tune regularly. Anchored windows keep all history from a fixed start, giving more stable parameters; they suit slower systems. The important part is choosing before you see results — switching after a disappointing run is itself a form of curve-fitting.

How much data do I need for walk forward analysis in India? Enough for at least 8–10 out-of-sample windows, each containing 20 or more trades. For a daily system that typically means four to six years of clean data; intraday systems can use less calendar time but need data that reflects current lot sizes, expiry schedules and trading hours.

Is forward testing the same as walk forward analysis? No. Walk forward analysis is done on historical data in rolling windows. Forward testing, or paper trading, runs the finished strategy in real time on live prices without real money. They are sequential: walk forward analysis first to check the edge is not fitted, then a forward test to check the rules work in live conditions, then small real capital with a journal.


Risk disclaimer

This article is educational and is not investment advice. Trading in equity, derivatives and commodities carries substantial risk of loss. SEBI's January 2024 study found that 93% of individual traders in the equity F&O segment made losses between FY22 and FY24. Results from a backtest, a walk forward test or a forward test do not guarantee future returns. Consult a SEBI-registered investment adviser and a qualified chartered accountant for advice specific to your situation.

Written by Pulkit Mangal — F&O trader since 2017 and founder of TradeDiary.

Last updated: 17 Sep 2026.