OptionDesk

How to Run a Walk-Forward Test on OptionDesk

A step-by-step guide to /backtest/walk-forward: pick a saved indicator strategy, choose what to sweep, set folds, then read efficiency and parameter stability.

Updated 2026-11-28 · 7 min read

On this page
  1. What does this screen do?
  2. How do you run one?
  3. What do the numbers mean?
  4. A worked example
  5. What mistakes do traders make?
  6. Next step

/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. 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?

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Common questions

What does the walk-forward screen on OptionDesk do?
It takes a saved indicator-based strategy, splits its date range into folds, tunes the parameters you choose on each fold's in-sample slice, and scores the winning combination only on that fold's out-of-sample slice, data the search never saw. It reports how much of the in-sample result survived and whether the winning parameters stayed consistent.
Which strategies can I walk-forward test?
Only rule-based strategies saved from the indicator backtest at /backtest/signals, on one symbol at a time. A time-based setup saved from /backtest does not open here, and a strategy holding a basket of symbols is refused. Opening a saved indicator setup from My strategies picks it for you.
What can I sweep?
Numbers inside your rule, such as an indicator length or a level, plus risk settings: for cash and futures runs the stop-loss percent, target percent, trail settings, bars held and entry delay, and for option runs the stop and target as percent of premium or in rupees, days held and spread width. Four parameters at most, and a grid cap of 240 combinations.
What is walk-forward efficiency?
Out-of-sample return divided by in-sample return, shown under Did it survive?. At 70% or more the screen says the in-sample result held up out of sample, between 35% and 70% it says part survived, and below 35% it says most did not, which is what overfitting looks like. It is withheld when the in-sample total was not positive. These thresholds describe hypothetical backtest data, are not a prediction, and are not indicative of future results.
What is the difference between anchored and rolling training windows?
Anchored trains on everything from the start up to each fold, which is what a strategy run forward actually has. Rolling uses a fixed-length window that slides forward and forgets old data, so it adapts faster to a regime change. The screen's own note says neither is correct, because they assume different things about how fast markets change.
How do I read the parameter stability output?
Under Did each parameter stay put?, each swept parameter shows the value chosen most often and the share of folds that chose it, green at 60% or more. If it lands on a similar value in most folds it is a real setting. If it moves every fold it is tracking noise, whatever that fold's out-of-sample P&L says. The 60% line is a hypothetical screen threshold, not a prediction and not indicative of future results.
How long does an options walk-forward take?
The screen tells you before you run. It states how many backtests the search will run, which is combinations times folds plus one per fold, and for options an estimate of the wait. The first option run of a session pays to load the archive. An options search too large for one request is refused, and a Stop button cancels a running search.

Disclosures

  • Not investment advice. OptionDesk provides tools, analytics, backtesting and education for NSE F&O only. It is not a SEBI-registered Investment Adviser or Research Analyst, and does not provide investment advice, buy/sell calls, tips or trade execution. You place every order yourself, through your own broker.
  • Projected, not promised. Every projected figure — payoffs, max profit/loss, probability of profit, target-date P&L and similar estimates — is “projected, not advice.” Backtested and simulated results are hypothetical, do not represent actual trading, and are not indicative of future results.
  • Delayed market data. Market data shown on OptionDesk is delayed by approximately one minute — it is not a live feed. It is provided for analysis and education only, and must not be relied on for time-sensitive execution.
  • F&O risk. Trading in futures & options carries a high risk of loss and is not suitable for every investor. Consider your objectives and risk tolerance, and seek independent advice where appropriate.

More in Test