/backtest/walk-forward takes a saved indicator strategy, tunes the parameters you choose on one slice of history, and scores the tuned version only on the next slice, data the tuning never saw. This page walks through the panels and how to read whether an edge is real or fit to one window.
Every rupee figure on this page is hypothetical. It comes from backtested runs on historical NSE data, projected, not advice, and not indicative of future results. Every trade is sized at today's lot size.
Walk-forward: pick a saved indicator strategy, choose what to sweep, set the folds.
What does this screen do?
Walk-forward is not a second backtest engine. It runs the same backtester many times, disciplined by a split. A single run answers "how did this rule perform on this data". If you then hand-tune the rule's parameters until that number looks good, you have fitted the rule to that window's noise, and the "improved" version often fails on data it has not seen. This screen forces the split, fold by fold, and reports what survived.
It runs only a rule-based strategy you saved from the indicator backtest, and it has no rule editor of its own, by design. It optimises one symbol at a time: a strategy holding a basket is refused. A time-based strategy saved from /backtest does not open here, and My strategies greys it out with the reason. It is not a guarantee generator. Clearing it means one specific thing: on this data the edge was not obviously an artefact of one window.
How do you run one?
- Strategy. Pick a saved indicator strategy. If none is saved, the step tells you to build one on the indicator backtest and press Save. From My strategies, Open in sends a saved indicator setup straight here.
- Parameters to sweep. Open the row and tick up to four. The list holds numbers inside your rule, such as an RSI length or a level, plus risk settings. For cash and futures runs these are stop-loss %, target %, trail every, trail tighten by, exit after N bars and enter N bars later. For option runs they are stop-loss % or ₹, target % or ₹, exit after N days and spread width. Each ticked parameter takes a from, to and step. The grid is capped at 240 combinations.
- Folds and objective. Folds: 2 to 12, default 5. Training window: Anchored or Rolling. Out-of-sample share: 10% to 60%, default 30%. Pick the combination with the best: Profit factor (default), Return over drawdown, Expectancy per trade or Net P&L. Ignore combinations under N trades: default 10.
- Read the line above Run. It says how many backtests this will run, which is combinations times folds plus one per fold, and for options an estimate of the wait. A refusal reads as a sentence, such as the grid being over the cap or the options search being too long for one request.
- Run walk-forward. A progress bar tracks fold and backtest count. Stop cancels.
Take the out-of-sample share seriously. Set low, each fold's scoring slice may hold too few sessions to say much. Set high, the search has too little data to find a stable parameter. There is no universally correct value.
What do the numbers mean?
Did it survive? shows In-sample P&L, Out-of-sample P&L, Efficiency and Backtests run. In-sample P&L is from the window each fold used to choose its parameters, so it almost always flatters. Out-of-sample P&L is from the window held back. Efficiency is out-of-sample over in-sample: at 70% or more the screen says the in-sample result held up, from 35% to 70% it says part survived, and under 35% it says most did not. Efficiency is withheld when the in-sample total is not positive, because a ratio against a losing denominator means nothing.
Did each parameter stay put? lists each swept parameter, the value chosen most often, and the share of folds that chose it (green at 60% or more), with every fold's choice in brackets. A parameter that jumps around has no real value.
The fold table. Trained on, Tested on, Chose, In-sample and Out-of-sample with the trade count. Read it row by row. One strong fold beside several weak ones is a reason to distrust the average.
Below that, the full results panel appears for the out-of-sample segments only.
A worked example
Strategy: NIFTY options, 5-minute bars, 1 Jan to 31 Dec 2025. Enter long when RSI(14) crosses above a level, by buying one at-the-money call, with a stop on the premium. Sweep two parameters: the RSI level (20, 30, 40) and the stop-loss % of premium (20, 30, 40). That is 9 combinations. Folds: 3, anchored, 30% out-of-sample, objective Profit factor, minimum 10 trades. The screen reported 30 backtests (9 combinations times 3 folds, plus 3). Three folds is the least that is worth running and was chosen to keep a 12-month options search short, so read it as an illustration of the screen, not a verdict. All figures are hypothetical, projected, not advice.
| Fold | Trained on | Tested on | Chose | In-sample | Out-of-sample |
|---|---|---|---|---|---|
| 1 | 1 Jan to 26 Mar 2025 | 27 Mar to 2 May | RSI level 40, stop 30% | -₹29,150 | +₹37,039 · 18 trades |
| 2 | 1 Jan to 25 Jul | 26 Jul to 31 Aug | RSI level 40, stop 30% | +₹13,617 | -₹12,342 · 22 trades |
| 3 | 1 Jan to 24 Nov | 25 Nov to 31 Dec | RSI level 40, stop 30% | -₹31,438 | -₹3,725 · 22 trades |
Reading it, in the order the screen suggests.
- Efficiency is withheld. The in-sample total was -₹46,971, not positive, and a ratio against a losing denominator means nothing. Out-of-sample P&L totalled +₹20,972, but a positive out-of-sample number beside a negative in-sample one is not a pass.
- The total rests on one fold. Fold 1 made +₹37,039. Folds 2 and 3 lost. Remove the first and the out-of-sample total is -₹16,067.
- The parameters did stay put. Under Did each parameter stay put?, the RSI level of 40 and the stop of 30% were each chosen in 100% of folds. That would normally read as stable. But 40 is the top of the range that was swept, so the search may simply have wanted to go higher, and the stable-looking answer says the range was too narrow, not that 40 is right.
- In-sample was mostly negative too. Two of the three training windows lost money even with the best combination, so "best" here meant least bad.
Stability, efficiency and the fold table disagree, which is the point of reading all three. A strategy that cleared the bar would show a positive in-sample total, an efficiency near or above the 70% line, and out-of-sample folds that are mostly positive.
What mistakes do traders make?
Reading out-of-sample P&L and skipping efficiency. A positive number with low efficiency still says the strategy underperformed its in-sample self.
Using too few folds. Two or three folds is barely more than one train and test split.
Setting the minimum trades too low. A fold that passes with three trades cannot tell an edge from luck.
Sweeping four parameters when one would do. Each added dimension multiplies the combinations, and the search finds luck faster than edge. The screen caps it at four for that reason.
Choosing Net P&L as the objective without thinking. It favours a combination that caught one or two outsized trades. Profit factor or return over drawdown reward steadier behaviour.
Expecting an instant options run. Read the estimate before you start and use Stop if the search is clearly too big.
Next step
Save an indicator strategy at /backtest/signals, open /backtest/walk-forward, sweep one parameter over three or four values, and read Did each parameter stay put? before the efficiency number.