BacktestingLearn · Backtesting

How options backtesting works (NIFTY & Sensex)

Options backtesting replays a fixed set of trading rules against historical option-chain data to see how a strategy would have behaved. It produces a simulated record of entries, exits, profit and loss, and drawdowns — so you can study an idea before risking anything. It is a research tool, not a prediction of future returns.

RD
Research desk10 Jun 2026 · 6 min read

What a backtest actually does

A backtest steps through history one bar at a time, in order, and applies your rules exactly as written. At each step it looks only at information that was available on that day — never the future — and records what the strategy would have done. The output is a simulated equity curve: a sequence of trades with their fills, costs and running profit or loss. Done honestly, it tells you how an idea has behaved across different market conditions. It does not tell you what will happen next.

start ₹10Lworst drawdownend balance
Illustrative equity curve — not a real or guaranteed result. Every backtest shows the worst dip, not just the headline number.

How historical option data is used

Options are harder to backtest than the index itself, because the contract you trade changes with every strike and expiry. A faithful backtest reconstructs the option chain as it existed on each historical day — the strikes that were listed, and the prices those contracts actually traded at — rather than guessing prices from a pricing model alone. For NIFTY and Sensex weekly options that means tracking the at-the-money strike as the index moves, rolling to the next expiry, and reading each contract's real intraday price path. The finer your data resolution, the more honestly intraday rules can be tested.

The honest caveats (read these)

The caveats are the most important part of any backtest. A clean equity curve that ignores the following is misleading, not encouraging.

  • Slippage. Your simulated fill is rarely the price you would actually get. Fast markets, gaps and large orders all move the fill against you, and a backtest can only estimate this.
  • Bid-ask spread. Options — especially away-from-the-money or far-expiry strikes — can have wide spreads. Paying the spread on every entry and exit quietly eats into results.
  • Costs and charges. Brokerage, exchange fees and statutory charges apply to every order. A strategy that looks profitable before costs can be a loser after them.
  • Sample size and overfitting. A handful of trades, or a window that only saw one kind of market, proves little. Rules tuned until the past looks perfect are usually fitting noise, not edge.
  • Survivorship and regime change. The future brings volatility, liquidity and behaviour the historical window never contained.
BrokerageSTTExchangeGSTSEBI + stamp
Illustrative split of Indian F&O costs (brokerage, STT, exchange, GST, statutory). Exact rates vary by broker and regulation — every backtest itemises them.

The single rule that matters most: a simulated or past result does not guarantee any future return. This is general information, not investment advice.

How to backtest an options strategy, step by step

Whatever tool you use, a sound backtest follows the same shape:

  1. Define the rules. Write exact entry, exit, strike-selection and risk rules — for example, sell the NIFTY weekly at-the-money straddle at 9:30 and exit at a fixed stop-loss or by 15:15.
  2. Pick instrument, period and resolution. Choose NIFTY or Sensex, a multi-year window that spans calm and volatile regimes, and a bar size — 5-minute bars for intraday rules.
  3. Replay against historical prices. Step through each bar in order, applying the rules to the option chain as it existed that day, and record every simulated trade.
  4. Apply realistic frictions. Subtract costs, model the spread, and add slippage so the result resembles a real fill.
  5. Read results with the caveats. Check sample size, study the worst drawdown, and remember the result is evidence, not a promise.
ALooks profitable with manageable risk.BProfitable, but the drawdown is large.CMarginally profitable. Could be luck.DLost money over this period.Too few trades to draw a conclusion.
Every backtest is translated into one of five plain-English verdicts — win-rate alone tells you nothing.

How Algoshastra backtests on real NIFTY & Sensex data

On Algoshastra you describe a strategy in plain English to an AI assistant called Shastra. It writes the strategy, then backtests it on real NIFTY and Sensex 5-minute bars — replaying your rules against how prices actually moved through each historical session rather than a smoothed daily summary. Costs and frictions are part of the simulation, so the result reflects an after-cost picture instead of a flattering before-cost one.

Backtesting is the core of verification. To understand how a strategy holds up, you verify it on real historical data — the same rules replayed on real prices with real costs and no real money at risk — then export the verified strategy to run on your own broker.

Common questions

What is options backtesting?

Options backtesting is replaying a fixed set of trading rules against historical option-chain data to see how the strategy would have behaved. It produces a simulated track record — entries, exits, profit and loss, and drawdowns — that helps you study an idea before risking anything live. It is a research tool, not a prediction.

Can you backtest a NIFTY options strategy?

Yes. With historical NIFTY (and Sensex) option-chain data, you can replay strike-selection, entry and exit rules across past expiries. Algoshastra backtests strategies on real NIFTY and Sensex 5-minute bars so intraday rules are tested against how prices actually moved through the session.

Why don't backtest results guarantee future returns?

A backtest only knows the past. Markets change regime, liquidity and volatility differently in the future, real fills face slippage and spread that a model can only approximate, and a strategy tuned to look good on historical data may be fitting noise. Treat results as one piece of evidence, never as a promise. This is general information, not investment advice.

How do you verify an options strategy before risking money?

You verify a strategy by replaying its exact rules against real historical option-chain data, with real costs and slippage modelled, so you see how it would have behaved across many past sessions including the worst ones. The results come from simulating the strategy's execution on real historical data — the prices are real, only the execution is simulated, so no real capital is at risk. Verification is research, not a forecast.

The honest frame

Investment in securities market are subject to market risks. Read all the related documents carefully before investing.

Backtested results are hypothetical, do not represent actual trading, and are not indicative of future results. This article is educational and is not investment advice or a recommendation; Algoshastra is a strategy-building and testing tool, not a registered investment adviser or research analyst. Past or backtested performance does not guarantee future returns.

Backtest performance does not guarantee future returns.All trading involves capital loss risk.algoshastra is a strategy-verification platform, not a SEBI-registered adviser or broker.You are responsible for all trades placed on your broker account.Past performance is for educational reference only.Backtest performance does not guarantee future returns.All trading involves capital loss risk.algoshastra is a strategy-verification platform, not a SEBI-registered adviser or broker.You are responsible for all trades placed on your broker account.Past performance is for educational reference only.