Learn · 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.

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.

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.

The honest frame

Algoshastra is a strategy-verification platform — there is no live broker order routing on the platform. You export verified strategies to run on your own broker. Everything here is for education and research. Backtests are simulations of strategy execution on real historical data; they do not predict or guarantee real outcomes. This is general information, not investment advice.

Start free How verification works
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.