Strategy backtests

How to Backtest Options Strategies on NIFTY and SENSEX

Backtesting an options strategy means replaying your exact entry and exit rules over real historical option prices to see how the strategy would have behaved — its win rate, drawdown shape, and trade count. A trustworthy backtest uses real historical option data (not synthetic prices), models brokerage, STT and slippage, avoids look-ahead bias, and applies intraday square-off. Algoshastra does this in plain English, no code. This is general information, not investment advice.

RD
Research desk15 Jun 2026
Build it in Shastra — paste this

Backtest a NIFTY strategy: buy one lot of the ATM call when the 9-EMA crosses above the 21-EMA on 5-minute bars, exit when it crosses back below, with a 30-point stop loss, and square off any open position at 3:15 pm.

Backtest it free

What backtesting an options strategy actually means

Backtesting is a controlled rehearsal. You write down your strategy's rules precisely — when to enter, when to exit, what stop loss or target to use, how many lots — and a backtester replays those rules bar by bar over historical market data, opening and closing simulated positions exactly as the rules dictate. The output is a record of how the strategy would have behaved: how often it was right, how deep its losing streaks went, how many trades it took, and how its profit and loss were distributed over time.

The point is not to find a number that looks good. The point is to understand a strategy's character before any real money is involved — its temperament in calm markets versus volatile ones, the size of the drawdowns you would have had to sit through, and whether it trades often enough to be meaningful. A backtest answers 'how did this behave?', never 'how much will I make?'

  • Entry rules: the signal that opens a position (e.g. an EMA crossover, a breakout, a time-of-day trigger).
  • Exit rules: stop loss, target, signal reversal, or a hard time-based square-off.
  • Instrument: which index (NIFTY, lot size 75; SENSEX, lot size 20) and whether you buy or sell the option.
  • Position sizing: how many lots per trade, kept consistent so results are comparable.

What a trustworthy options backtest needs

Options are not stocks. An option's price is driven by the underlying's move, time decay, and implied volatility all at once — so a backtest that only has the index's price and tries to estimate the option premium from a formula can drift far from what actually traded. A trustworthy options backtest replays the real historical option premiums that printed at each strike, not a synthetic guess.

Four things separate a credible backtest from a misleading one. Get any of them wrong and a weak strategy can look strong.

  • Real historical option data: actual traded premiums at real strikes on 5-minute bars, not prices reverse-engineered from the index.
  • Costs modelled: brokerage, STT, exchange and SEBI charges, plus realistic slippage — real fills rarely match the mid-quote, especially on far or illiquid strikes.
  • No look-ahead bias: at every bar the strategy may only use information that existed at that moment; it must never 'peek' at a price that hadn't printed yet.
  • Intraday square-off: an intraday strategy must be forced to close by a fixed time (Algoshastra squares off at 3:15 pm IST), so the result reflects rules you could actually follow.

How Algoshastra backtests in plain English (no code)

With Algoshastra you describe the strategy the way you would explain it to a colleague — 'buy one lot of the ATM NIFTY call when the 9-EMA crosses above the 21-EMA, exit on the reverse cross, 30-point stop loss, square off at 3:15' — and Shastra, the AI, turns that into a runnable strategy. There is no Python, no formula-writing, and no spreadsheet.

Behind the scenes the backtest runs on a position-aware, rolling-ATM historical feed of 5-minute option bars. 'Position-aware' means the engine tracks the strike you actually hold as the index moves; 'rolling-ATM' means it follows the at-the-money strike over time the way a real intraday trader would. Brokerage, STT and slippage are applied on every simulated fill, and intraday positions are squared off at 3:15 pm IST — so the behaviour you see is grounded in rules you could genuinely have traded.

Algoshastra is a strategy-verification platform. It is not SEBI-registered and supports no live-money trading. Everything here is for learning the mechanics, not a recommendation to trade.

How to read a backtest result honestly

The biggest mistake is staring at the headline total. A single big number tells you almost nothing — it can come from one lucky day, or hide months of grinding losses. Read the shape of the result instead.

Look at the win rate together with average win versus average loss; a 40% win rate can still be healthy if winners are larger than losers. Look at the worst drawdown and ask honestly whether you could have held through it. Check the number of trades — a strategy tested on a handful of trades has proven nothing. And always re-run across different market regimes, because a strategy that thrives in a trend can bleed in a sideways market, and vice versa.

Treat any backtest as a description of the past, not a forecast. Past behaviour is not indicative of future results, and the cleanest backtest in the world cannot promise a single rupee. Run it yourself, in several periods, and let the numbers you generate inform your understanding — not a number we quote.

  • Win rate paired with average win / average loss, not win rate alone.
  • Maximum drawdown — the worst peak-to-trough dip you would have endured.
  • Trade count — enough trades for the result to mean something.
  • Behaviour across regimes — trending up, trending down, and sideways.

Explore the spoke guides and a payoff calculator

This hub links down to worked examples for the most common index-option strategies. The EMA-crossover guide is a long-option (buying calls/puts) strategy that is fully backtestable in Shastra today — you can run it free and see the behaviour for yourself.

Short straddle and iron condor are credit (option-selling) strategies. These are not yet fully backtestable in Algoshastra — the backtester currently models long-option strategies, while short-premium and margin handling are on the roadmap. For those, use the free options strategy builder to see the expiry payoff and risk profile now, and treat full credit-strategy backtesting as coming.

  • EMA crossover (long options) — fully backtestable in Shastra today; see the EMA-crossover guide.
  • Short straddle (credit) — view the payoff in the free strategy builder; full backtest is on the roadmap.
  • Iron condor (credit) — view the payoff in the free strategy builder; full backtest is on the roadmap.
  • How options backtesting works — the deeper mechanics behind the engine.
  • Export to your broker — take a verified strategy and run it on your own broker account.
How to read a backtest honestly
  • Algoshastra's backtester runs on a position-aware, rolling-ATM historical option feed — a realistic but showcase-grade sandbox, not a tick-by-tick reconstruction of every strike in the order book.
  • Data is on 5-minute bars; moves and fills inside a 5-minute window are not captured, so very fast intraday strategies will look smoother than reality.
  • Brokerage, STT and slippage are modelled with reasonable assumptions, but your real broker's costs and the actual slippage on illiquid strikes can differ.
  • This is a strategy-verification platform — no live-money trading, and Algoshastra is not SEBI-registered.
  • Past backtested behaviour is not indicative of future results; a clean backtest is a description of history, not a forecast.
  • Results depend heavily on the sample period and market regime chosen — always test across trending and sideways stretches rather than a single favourable window.
  • Credit / option-selling strategies (short straddle, iron condor) are not yet fully backtestable here; use the free payoff calculator for those until short-premium support ships.

Common questions

What does it mean to backtest an options strategy?

It means replaying your exact entry and exit rules over real historical option prices to see how the strategy would have behaved — its win rate, drawdown depth, trade count, and P&L distribution. It describes past behaviour; it does not predict or promise future results. This is general information, not investment advice.

What data do I need to backtest NIFTY or SENSEX options properly?

You need real historical option premiums at actual strikes — not prices estimated from the index alone. Algoshastra uses a position-aware, rolling-ATM feed of 5-minute option bars and models brokerage, STT and slippage, so the result reflects costs you would actually have paid.

Do I need to know coding to backtest a strategy on Algoshastra?

No. You describe the strategy in plain English — index, entry signal, exit rule, stop loss or target, and lots — and Shastra, the AI, turns it into a runnable strategy and backtests it. There is no Python or spreadsheet work involved.

Can I backtest a short straddle or iron condor here?

Not fully yet. Algoshastra's backtester currently models long-option (buying) strategies; short-premium and margin handling for credit strategies are on the roadmap. For a short straddle or iron condor, use the free options strategy builder to see the expiry payoff and risk now.

Why shouldn't I just trust the headline profit number?

A single total can come from one lucky day or hide long losing streaks. Read the shape instead — win rate versus average win/loss, the worst drawdown, the trade count, and behaviour across trending and sideways regimes — and re-run the backtest across multiple periods yourself.

Is Algoshastra safe to use, and is it SEBI-registered?

Algoshastra is a strategy-verification platform with no live-money trading. It is not SEBI-registered. It is built for learning strategy mechanics and backtesting on historical data, not for executing real trades, and nothing on it is a recommendation to buy or sell.

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.