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.
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.
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:
- 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.
- 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.
- 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.
- Apply realistic frictions. Subtract costs, model the spread, and add slippage so the result resembles a real fill.
- Read results with the caveats. Check sample size, study the worst drawdown, and remember the result is evidence, not a promise.
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.