Look at India VIX on two days. On 24 Nov 2025 it closed at 13.24. On 22 Apr 2026 it closed at 18.30, after standing at 12.25 on 4 Feb. A volatility rule tuned on the quiet autumn would meet that spring as a stranger. Walk forward testing is the method that makes a rule meet strangers on purpose. It fits the rule on one stretch of history, trades the next stretch it has never seen, then slides forward and does it again. This lesson sets out the method on the 300 sessions in the school's files, shows the four test windows they give and what each window holds, and says what the method cannot fix. The rule in the example is made up, and nothing here is a view on where Nifty goes.
3By the end you can
- Split data into fit and test parts and say when a test part stops being out of sample.
- Work out folds, tested sessions and efficiency for a walk forward run.
- Name leakage, an embargo and the signs that a fit is chasing noise.

The idea, plainly
What is out of sample testing?
Split the history in two. Fit the rule, and every parameter in it, on the first part. Then run it once on the second part, with nothing changed. The second part is out of sample: the rule has not seen it. The split has one strict law. The moment a result on the second part makes you change the rule, that part has become in sample, because it shaped the choice. A common way a backtest fails is a test set that was looked at before it was used. The lesson on biases explains why a version count matters, and a clean out of sample test is one guard against it.
What is walk forward testing?
A single split uses the test part once. Walk forward repeats the split along the calendar. Fit on a training window of 100 sessions, freeze the parameters, trade the next 50 sessions, record the result, then move the windows forward by 50 sessions and fit again. The test windows never overlap, and each is traded with parameters that were fitted only on the past. Joined end to end, they form one out of sample record. With 300 sessions this gives 4 folds, so 200 sessions are tested out of sample, 66.7% of the data. A single split that fits on 70% of the data tests 90.
Each fold fits first, freezes, and only then meets new data
Walk forward tests 66.7% of the sessions out of sample
Rolling or anchored, and how long a window?
A rolling window drops old data as it moves, so the fit follows recent markets and ignores the distant past. An anchored window keeps the start fixed and grows, so the fit leans on more data and reacts more slowly. Neither is correct in itself. The choice is a guess about whether the market's rules change, and both options should be written down before the run. Window length is the same trade: short windows adapt and fit noise, long windows are steadier and may fit a regime that has gone. A fold also needs enough trades to say anything. A weekly rule trades about 10 times in a test window of 50 sessions, far fewer than the trades a result needs.
Maths: folds, tested sessions and efficiency
Folds = (N − train)
÷ test
Tested = folds × test
Efficiency =
mean test result
÷ mean fit result
Here N is the number of sessions. With N = 300, train = 100 and test = 50, folds = 4, and tested sessions are 200. Efficiency compares what the rule earned on data it had not seen with what it earned on data it was fitted to. A value near one says the fit was not much flattered. A value near zero says it was.
What is leakage, and what is an embargo?
A trade that lasts days carries the end of the training window into the start of the test window: the last training trades are scored on prices from the test window, so the fit has seen part of the test. A feature built from a twenty day average does a milder version of the same, because the first test rows share most of their inputs with the last training rows. The remedy is an embargo, a gap between the two windows in which nothing is traded or scored, at least as long as the holding period and, to be careful, as long as the feature's window. An option position that runs to expiry needs the gap to reach to that expiry. It is also tidier to cut folds at expiries, so no trade is split across the boundary.
The term this section turns on: Embargo
Does it suit options?
It fits, with three extra cares. An option trade ends at an expiry, so a fold should begin and end on expiry dates, and no position may be open across a boundary. The contract changes inside the history: the lot, the expiry day and the charges in the lesson on options backtests all differ between folds, so every fold needs its own table of rules. And volatility regimes are the largest source of difference between windows. A short volatility rule fitted in a calm fold will meet a spike in another. The method does not hide that. It shows it, one fold at a time.
How do I read the result?
Three checks, in this order. First, the stitched test record, judged by the measures in strategy metrics, not by the training fits. Second, the efficiency ratio: a rule whose test results are a small part of its fit results was mostly fitted. Third, and the one I look at before the total, the parameter that wins each fold. If it sits near the same value in every fold, the rule has found something stable. If it jumps from fold to fold, the fit is chasing noise. A rule can show a good stitched record and still fail this third check.
Four test windows come out of the school's 300 sessions
- Test 1
Fit on 1 Jul to 24 Nov 2025, then trade 25 Nov 2025 to 4 Feb 2026.
- Test 2
Fit on 11 Sep 2025 to 4 Feb 2026, then trade 5 Feb to 22 Apr 2026.
- Test 3
Fit on 25 Nov 2025 to 22 Apr 2026, then trade 23 Apr to 6 Jul 2026.
- Test 4
Fit on 5 Feb to 6 Jul 2026, then trade 7 Jul to 15 Sep 2026.

Where does a final holdout go?
Walk forward folds are used to build and tune. Keep a last stretch of history outside all of them, a final holdout, and look at it once, after the rule and its windows are frozen. The folds may be reused as often as the work needs, since they are part of the fit. The holdout may be spent once. If it fails, the honest options are to stop or to start a new rule with a new holdout. Going back to retune against the same holdout makes it a fold.
How do I lay out my own folds?
Take any series of dates, such as the school's files, and lay out your own folds before running anything. Write down five choices: the training length, the test length, the step, the gap and whether the window rolls or anchors. Count the sessions in each fold and the trades you expect in each test window. Work out how many folds you get and what share of the data is tested out of sample. Then ask whether the trades per fold are enough to say anything. If they are not, no choice of windows will fix it, and the answer is a longer history or a rule that trades more often.
Worked example: four folds of a made up rule
The test windows are real and the rule is not. Each window is a different market. The table gives, for each, the move in Nifty over the window and India VIX at its start and end. A rule fitted before a window never saw it.
| Test window | Nifty | VIX, start to end |
|---|---|---|
| 1: 25 Nov to 4 Feb | −0.7% | 13.24 to 12.25 |
| 2: 5 Feb to 22 Apr | −5.4% | 12.25 to 18.30 |
| 3: 23 Apr to 6 Jul | 0.2% | 18.30 to 11.82 |
| 4: 7 Jul to 15 Sep | −5.4% | 11.82 to 13.43 |
The four test windows meet four different volatility regimes
| Made up fold | Fit | Test | Lookback |
|---|---|---|---|
| 1 | 1.8 | 0.9 | 10 |
| 2 | 2.1 | 0.1 | 40 |
| 3 | 1.6 | 1.1 | 15 |
| 4 | 2.0 | 0.2 | 60 |
Each fold scored lower on data it had not seen
Read 3 more paragraphs, 154 words
Window 2 holds the spring of 2026, when VIX climbed from 12.25 to 18.30. Window 3 begins in that stress and ends calm. The same rule faces four temperaments, and a single split would have tested it on one of them.
Now the rule's own numbers, all made up. The fit score of each fold is the rule's Sharpe ratio on its training window. The test score is the Sharpe ratio on the window after it. The last column is the fitted parameter, a lookback in sessions.
The fit scores average 1.88 and the test scores 0.58, so efficiency is 0.31. Every fold paid for being tested, which is the usual shape: a fitted rule looks better than it is. The lookback wandered between 10 and 60 sessions, which is the third check failing. A rule whose best parameter changes sixfold from fold to fold has no single setting worth trusting.
The common mistake
The belief: I used walk forward testing, so the result is out of sample.
It is only as out of sample as the discipline behind it. If the rule, the window lengths or the markets changed after a look at the folds, the folds joined the fit and the run is in sample at one remove. Walk forward also reuses one history. It cannot make the data longer, and it cannot add a crash that did not happen. Keep a final holdout, a stretch of data nobody touches until the rule is frozen, and spend it once. A pass there is still a record of the past. SEBI lets only registered advisers, research analysts and empanelled algo providers make performance claims, verified by a PaRRVA. Monte Carlo and bootstrap asks how much of the result could be luck.
Key takeaways
- A test part is out of sample only until a result changes the rule.
- Walk forward repeats fit, freeze and test along the calendar.
- Four folds from the files test two thirds of the data.
- Cut an embargo gap as long as the holding period or feature window.
- A best parameter that jumps between folds is a sign of fitting noise.
- Ten trades a fold cannot carry a verdict by itself.

Before you trade. Derivatives trading carries a high risk of loss. SEBI's study "Profitability of Individual Traders in the Equity Derivatives Segment (FY25 to FY26)" (August 2026) found that 87.7% of individual traders in equity F&O made net losses in FY26, with aggregate net losses of Rs 91,685 crore. Read the SEBI study