How to backtest an options strategy in India, step by step
A practical method for backtesting NIFTY, BANK NIFTY and SENSEX option strategies: exact contracts, 1-minute data, next-bar fills, charges and expiry rules.
- By
- Veloce team
- Published
- Reading time
- 11 min read
On this page
- Why options backtests are harder than stock backtests
- Step 1: write the strategy down completely
- Step 2: use data for the contracts you would have traded
- Step 3: decide on closed candles, fill at the next open
- Step 4: charge every fee
- Step 5: handle expiry the way the exchange does
- Step 6: read the result as a distribution, not a number
- Step 7: tune on one period, confirm on another
- Common mistakes and how to avoid them
- Try it in Veloce
To backtest an options strategy properly, write every rule down before you look at results, replay the recorded prices of the exact contracts the strategy would have chosen (strike, expiry, call or put), let it decide only on candles that have already closed, fill its orders at the next candle’s open with slippage, charge every fee, and settle anything still open at expiry the way the exchange does. Then tune on one period and confirm on a later one you never looked at. This guide walks through each step with NIFTY weekly options as the running example, using the same rules the Veloce engine applies.
Why options backtests are harder than stock backtests
A stock or index backtest replays one price series. An options backtest has to deal with thousands of contracts, each of which exists for a few weeks and then disappears.
- The contract is chosen at entry. “Sell the at-the-money call” means a different strike and expiry every day. The test has to work out which contract that was at that moment, then replay that contract’s own prices.
- Premiums do not follow the index one for one. Time decay and implied volatility move option prices even when NIFTY is flat. Estimating premiums from the index with a pricing model hides exactly the effects option sellers and buyers are trading.
- Contracts expire. Anything still open at expiry is settled in cash at its intrinsic value. A backtest that forgets this either keeps a dead contract open or closes it at a made-up price.
- The rules of the market change. NIFTY weekly options expired on Thursdays until August 2025 and on Tuesdays from September 2, 2025 (NSE/FAOP/68747). The NIFTY lot size went from 75 to 65 for weekly contracts expiring from January 6, 2026 (NSE/FAOP/70616). STT on option sales rose from 0.1% to 0.15% of premium for trades from April 1, 2026 (Finance Bill 2026 memorandum). A test that spans those dates needs to know about them.
None of this is exotic. It is simply what an options trade involves, and each item is a place where a backtest can quietly flatter a strategy.
Step 1: write the strategy down completely
Most bad backtests start with a vague strategy. “Sell a straddle in the morning and exit if it goes wrong” cannot be tested; it can only be argued about. Before running anything, fill in every row of this table.
| Rule | Question to answer | Example |
|---|---|---|
| Underlying | Which index? | NIFTY 50 |
| Candle | What candle size drives decisions? | 1 minute |
| Entry time | Earliest and latest candle close to enter | 10:00, no later limit |
| Entry condition | Signal, or enter whenever allowed? | No signal |
| Re-entry | Once a day, once per expiry, or whenever flat? | Once per expiry |
| Legs | Call or put, buy or sell, ratio | Buy put, buy call, sell put, sell call |
| Strike | How far from the money, or by premium | Sold legs 4 strikes out, bought legs 8 out |
| Expiry | Nearest, next, or at least N days away | Nearest weekly, at least 5 days away |
| Exits | Profit target, stop, trailing stop, time exit | 50% of credit, 2× credit, 1 day before expiry |
| Grouping | Are exits checked per leg or for the whole position? | Whole position |
| Size | Lots, and any limits on risk | 1 lot, worst loss at expiry ≤ 2% of equity |
| Costs | Charges and slippage | NSE option charges, 1 tick |
If a row is blank, the backtest will fill it in for you with an assumption, and you will not know which one. In Veloce the whole table is a strategy spec, a piece of data the engine compiles into a strategy. The example above, written as a spec, looks like this:
{
"name": "nifty-weekly-condor",
"candle_minutes": 1,
"entry": { "first_entry": "10:00", "min_days_to_expiry": 5, "reenter": "each_expiry" },
"legs": [
{ "kind": "option", "option_type": "put", "side": "buy", "strike": { "kind": "atm_offset", "steps": 8 } },
{ "kind": "option", "option_type": "call", "side": "buy", "strike": { "kind": "atm_offset", "steps": 8 } },
{ "kind": "option", "option_type": "put", "side": "sell", "strike": { "kind": "atm_offset", "steps": 4 } },
{ "kind": "option", "option_type": "call", "side": "sell", "strike": { "kind": "atm_offset", "steps": 4 } }
],
"exits": {
"group_by": "expiry",
"rules": [
{ "kind": "take_profit", "amount": { "kind": "share_of_credit", "fraction": "0.5" } },
{ "kind": "stop_loss", "amount": { "kind": "share_of_credit", "fraction": "2" } },
{ "kind": "before_expiry", "days": 1 }
]
},
"risk": { "rules": [{ "kind": "max_loss_at_expiry", "fraction": "0.02" }] }
}
Anything left out takes a documented default: NSE option charges, a next-open fill and one tick of slippage. The iron condor guide works through this exact position with numbers.
Step 2: use data for the contracts you would have traded
The minimum data for an honest options backtest is the recorded price history of every contract the strategy could pick, at the candle size you decide on, for the whole test period, including contracts that have long since expired.
Three details matter more than they look:
- One-minute candles. Veloce stores one-minute candles and builds larger ones from them, anchored at the 09:15 session open, so a 5-minute strategy sees the same 09:15, 09:20, 09:25 candles a chart would show. Stops and fills are only as precise as the candles replayed; the intraday vs positional guide shows how much a coarse candle can hide.
- Strikes near the money. Veloce fetches option history for strikes within ten strike steps of the money for the nearest expiry, and three for later expiries. For NIFTY that is ±500 points on the weekly. A strategy that asks for a strike outside that range, or one with no recorded candle in the week before entry, stops with a clear error instead of trading at an invented price.
- A correct expiry calendar. The weekly expiry falls on the scheduled weekday unless that day is a holiday, in which case it moves to the previous trading day. Veloce builds its calendar from the exchange rule in force on each date (NIFTY Thursday until August 2025, Tuesday after; SENSEX Thursday; BANK NIFTY the last Tuesday of the month) and from the actual trading days, so a holiday-shortened week expires on the right day.
Lot sizes change over time, and Veloce follows them: each contract gets the lot size in force for its own expiry from the exchange’s dated schedule (for NIFTY, 75 for contracts expiring before January 6, 2026 and 65 after; for BANK NIFTY, 35 then 30; for SENSEX, 20 then 25 from the January 2027 expiries). A --lot-size setting overrides it for the whole run if you want to compare periods per lot.
Step 3: decide on closed candles, fill at the next open
This is the single most important rule in any backtest, and the easiest to break. A candle’s close is not known until the candle ends. A strategy that sees the 10:00 close and buys at that same close is trading on information it could not have had.
Veloce enforces this in the engine rather than leaving it to each strategy. For every moment in the replay, all candles that start at that moment are first given to the simulated broker, which fills any waiting orders at their open. Only then does the strategy see the candles that just closed. A strategy cannot reach the price it trades at.
Slippage sits on top. By default a buy fills one tick (₹0.05 for index options) above the open and a sell one tick below, rounded to the tick. On a sold leg opening at ₹42.60 the fill is ₹42.55; on a bought leg opening at ₹18.40 it is ₹18.45. You can set more ticks, a share of the price, or none.
Two consequences are worth knowing before you read any result:
- A stop is a decision, not a guaranteed price. Exits are checked on candle closes, so a stop set at a ₹2,500 loss triggers on the first close at or beyond that loss and fills at the next open. On a fast candle the realised loss is larger than the stop. That is closer to what a stop-market order does in a real market than a backtest that fills exactly at the stop level.
- The fill waits for the contract to trade. The order fills at the next candle of that option, not of the index. An illiquid strike that does not print for several minutes fills later, at whatever price it opens at.
The lookahead bias guide covers the other ways future information leaks into a test.
Step 4: charge every fee
Index option trades in India carry brokerage, exchange transaction charges, the SEBI fee, STT on the sell side, stamp duty on the buy side, and GST on brokerage and fees. Each is small. Together, on a strategy that trades four legs twice a week, they are not.
Veloce’s default NSE option charges, applied to each fill, are:
| Charge | Rate in Veloce | Applies to |
|---|---|---|
| Brokerage | ₹20 per order | Every order |
| Exchange transaction charge | 0.03503% of premium | Both sides |
| SEBI fee | 0.0001% of premium | Both sides |
| STT | 0.15% of premium | Sells only |
| Stamp duty | 0.003% of premium | Buys only |
| GST | 18% | Brokerage, exchange charge and SEBI fee |
The STT rate matches the rate for option sales from April 1, 2026 set out in the Finance Bill 2026 memorandum. Brokerage depends on your broker, so set your own figure if it differs.
For scale: the four-leg iron condor in the iron condor guide collected a credit of ₹3,100.50 on one lot. Entry charges were ₹105.03 and exit charges ₹96.63, a total of ₹201.66, or about 6.5% of the credit. A strategy whose average winner is a few hundred rupees per lot can be profitable before charges and losing after them.
Step 5: handle expiry the way the exchange does
NIFTY, BANK NIFTY and SENSEX options are European and cash-settled: an option held to expiry is worth its intrinsic value against the index close on expiry day. Veloce settles any option still open at the close of the derivatives session on expiry day (15:30, or 15:40 from August 3, 2026, when NSE extended its F&O session) at its intrinsic value from the index’s daily close. Out-of-the-money options settle at zero.
Two practical notes:
- Veloce books settlement without charges. If a strategy holds long in-the-money options to expiry, STT on exercise (0.15% of the intrinsic value for trades from April 1, 2026, payable by the buyer) is not in the result, so add it yourself or exit before the close.
- Many strategies should not hold to expiry at all. A
before_expiryexit closes the position a set number of calendar days before the contracts expire, and a dailysquare_offtime closes intraday strategies before the session ends.
Step 6: read the result as a distribution, not a number
A single net P&L figure hides most of what matters. For each run, Veloce reports net P&L, total return on the starting capital, maximum drawdown, number of trades, win rate, profit factor, total charges, and the peak capital at risk: the largest worst-case loss at expiry of all open positions at any moment. A naked short call has no bounded worst case, so it shows as unlimited.
Questions to ask of every result:
- How many trades? Twenty trades with a 70% win rate is a coin that landed heads 14 times. It does not rule out much.
- How deep was the worst drawdown compared with the average month? A strategy that makes ₹3,000 a month and once lost ₹40,000 in a week has a very different risk than its average suggests.
- What did charges take? If charges are more than a third of gross profit, small changes in brokerage or slippage decide whether the strategy works.
- Which exit closed the trades? A strategy where most profit comes from a handful of trades held to expiry depends on those weeks repeating.
- What was the peak capital at risk? This is the number to compare profit against, especially for sellers.
Veloce does not compute exchange margin (SPAN plus exposure) for option sellers, so return on margin is something to work out separately from the peak capital at risk and your broker’s margin figures.
Step 7: tune on one period, confirm on another
Once a strategy has settings (an entry time, a strike distance, a stop), it is tempting to try many values and keep the best. The best value on past data is partly the best strategy and partly the luckiest fit to that particular stretch of history. The cure is to hold some history back.
Veloce’s sweep runs every combination of the settings you vary, ranks them by net P&L on the tuning period, and then reruns the top few on a later check period they were never tuned on. A sweep of the iron condor might look like this:
| Sweep input | Value |
|---|---|
| Tuning period | March 1 to August 31, 2026 |
| Check until | October 31, 2026 (so the check period is September 1 to October 31) |
| Settings to vary | Short distance 3, 4, 5 strikes; stop loss 1.5× or 2× the credit |
| Settings to check | The best 3 of the 6 combinations |
If the best settings on March to August fall apart from September to October, the result was mostly fit. The overfitting guide explains how to read a sweep, and the sweeps page describes the feature.
Common mistakes and how to avoid them
| Mistake | What it does to results | Fix |
|---|---|---|
| Filling at the signal candle’s close | Trades at a price the strategy could not have known | Fill at the next candle’s open |
| Pricing options from the index with a model | Misses volatility and liquidity effects | Replay recorded option prices |
| Ignoring charges and slippage | Inflates frequent, small-edge strategies | Charge every fee, add at least one tick |
| Wrong expiry weekday or holiday handling | Holds contracts a day too long or too short | Use the exchange’s rule for each date |
| Mixing lot sizes across years | Scales rupee P&L wrongly | Fix the lot size for the period, or compare per lot |
| Testing only a calm period | Hides the weeks that decide a seller’s year | Include volatile periods |
| Tuning and judging on the same data | Rewards luck | Hold back a check period |
| Holding through expiry without settlement | Leaves dead contracts open or settles at a made-up price | Settle at intrinsic value, or exit before expiry |
Try it in Veloce
Veloce runs these steps for you on NIFTY 50 weekly and BANK NIFTY monthly options, SENSEX weekly options, and MCX gold and gold mini futures, all on one-minute data. Write a strategy as a spec or pick one of the built-in strategies, set the exits and risk limits, and read how the engine fills each order. Backtests and sweeps are available today; paper and live trading are not yet.
Create a free Veloce account and run your first options backtest. For the terms used here, see the glossary and the NSE index options page.
Frequently asked questions
- Can I backtest an options strategy using only NIFTY index prices?
- Only roughly. An option's price depends on time to expiry and implied volatility as well as the index, so a test that guesses premiums from the index can be far off. A sound test replays the recorded prices of the exact contracts the strategy would have traded.
- What candle size should I use to backtest intraday options?
- Use one-minute data as the source. You can build 3, 5 or 15 minute candles from it for signals, but stops, fills and expiry-day moves are only as precise as the candles you replay.
- At what price should a backtest fill an order?
- At a price the strategy could not have seen when it decided. Veloce decides when a candle closes and fills at the open of the contract's next candle, then adds slippage of one tick by default.
- Do charges matter much for option strategies?
- Yes, especially for multi-leg and low-premium trades. In the iron condor example in this article, brokerage, exchange fees, STT, stamp duty and GST came to about 6.5% of the credit collected.
- How many trades do I need before trusting a backtest?
- There is no fixed number, but a handful of trades tells you very little. Prefer periods that include trending, range-bound and high-volatility weeks, and confirm on a later period you did not tune on.
- Does Veloce support paper or live trading?
- Not yet. Veloce runs backtests and parameter sweeps on historical one-minute data. Paper and live trading are not shipped.
Sources
- NSE circular NSE/FAOP/68747: revision in expiry day of index and stock derivatives (June 25, 2025)nsearchives.nseindia.com, accessed
- NSE circular NSE/FAOP/70616: revision in market lot of derivative contracts on indices (October 3, 2025)nsearchives.nseindia.com, accessed
- Union Budget 2026-27, Memorandum explaining the provisions of the Finance Bill (STT on options)indiabudget.gov.in, accessed
- SEBI circular SEBI/HO/MRD/TPD/P/CIR/2024/132: measures to strengthen equity index derivatives framework (October 1, 2024)sebi.gov.in, accessed