Options Strategy Backtesting for NIFTY and BANKNIFTY
Stolo's backtest tool replays a multi-leg options strategy over historical NIFTY and BANKNIFTY data and tells you how it would have done. You build the legs, set the strike selection, the stop loss, the re-entry and trailing rules, pick a date range, and the engine runs every session in that window and reports the full performance picture: equity curve, drawdown, win rate, profit factor and a trade-by-trade log.
The problem it solves
Most option strategies sound good in a WhatsApp group and fall apart in a drawdown you did not see coming. The only way to know how a rule set behaves is to run it over a few hundred sessions, including the bad ones. Doing that by hand in a spreadsheet is unrealistic for anything with re-entries and trailing stops. The backtest engine does it properly, with the same strike logic and exit rules you would trade live.
The concept
- Define the strategy, not a single trade. Legs, entry time, exit time, strike selection method, and the stop, target, trailing and re-entry rules.
- Replay every day. For each session in the date range, the engine enters at your entry time, applies your rules bar by bar, and closes at your exit time or when a stop fires.
- Aggregate the results. Every day becomes one row in a P&L series, which the engine turns into an equity curve and a set of risk statistics.
- Stress the parameters. A strategy that only works at one exact stop-loss value is curve-fitted. Grid Search, Heatmap and Walk-Forward test for robustness.
Building a strategy
The base
- Underlying: NIFTY or BANKNIFTY.
- Underlying source: cash or future, for strike and delta reference.
- Entry and exit time: for example enter 09:20, exit 15:15.
- Date range: the historical window to test.
Each leg (up to six)
- Segment and position: options or futures, buy or sell.
- Option type and expiry: CE or PE, weekly, next weekly, monthly or next monthly.
- Strike selection: ATM, OTM, ITM, exact, percent of ATM, premium range, closest premium, premium greater than, straddle width, synthetic future, ATM straddle premium percent, closest delta, or delta range.
- Lots.
- Stop loss and target: in points, underlying points, premium percent, underlying percent, or delta.
- Trailing stop: trigger and trail-by amount, in points, percent or delta.
- Momentum entry: wait for a points or percent move before the leg goes on.
- Re-entry: RE-ASAP, RE-COST or RE-MOMENTUM and their reverse variants, with a max count and a no-re-entry-after time.
- Lazy legs: an entirely different leg that only activates when this leg's stop or target fires, for modelling adjustments. Lazy legs can cascade.
Overall (strategy-level)
- Overall stop loss: MTM value or total premium percent.
- Legwise settings: partial or complete square-off, trail remaining legs to breakeven.
- Overall momentum, overall re-entry, and an overall trailing stop.
- Range breakout entry: enter on a break of a defined opening range, high or low, on the instrument or the underlying, with its own stop and re-entry.
Key terms explained
| Term | What it means |
|---|---|
| Leg | One option or futures position in the strategy. |
| Strike selection method | The rule that picks each leg's strike, from ATM offsets to premium and delta targets. |
| RE-ASAP / RE-COST / RE-MOMENTUM | Re-entry modes: re-enter immediately, re-enter at the original cost, or re-enter on a momentum trigger. |
| Lazy leg | A leg that activates only when another leg's stop or target fires. |
| MTM stop | An overall stop based on mark-to-market profit or loss for the whole strategy. |
| Profit factor | Gross profit divided by gross loss. Above 1 is profitable, above 1.5 is good. |
| Max drawdown | The largest peak-to-trough fall in the equity curve. |
| Sharpe / Sortino / Calmar | Risk-adjusted return ratios, computed on the daily P&L series. |
| Walk-forward | Optimise on an in-sample window, measure on the next out-of-sample window, roll forward. |
A worked example
You want to test a classic BANKNIFTY 9:20 short straddle with a stop.
- Base: BANKNIFTY, cash reference, enter 09:20, exit 15:10, range 1 January 2025 to 1 June 2025.
- Leg 1: sell CE, weekly, ATM, 1 lot, stop loss 30 percent of premium.
- Leg 2: sell PE, weekly, ATM, 1 lot, stop loss 30 percent of premium.
- Overall: MTM stop at minus 4,000, square-off complete.
Run it. The summary comes back: total P&L plus 82,000, 104 trading days, win rate 61 percent, profit factor 1.34, max drawdown minus 18,500, Sharpe 0.9. The equity curve rises steadily then gives back a chunk in the March expiry week. The trade table shows the worst day was a trending move where both stops hit.
Now open Grid Search and sweep the per-leg stop from 20 to 50 percent. You find that 25 to 35 percent all produce a similar profit factor while 20 percent stops out too often and 50 percent lets losers run. That flat region is the robust choice, not whichever single value scored highest.
How to use it in Stolo
- Log in to Stolo and open Backtest from the main menu.
- On the Strategy Builder tab, set the underlying, entry and exit time, and the backtest date range.
- Add your legs. For each, pick the strike selection method, lots, and any stop, target, trailing or re-entry rules.
- Add overall rules if you want an MTM stop or strategy-level trailing.
- Click Run. The job queues and the results appear when it finishes.
- Read the summary stats, then the equity curve, drawdown and monthly heatmap, then the trade table for the bad days.
- Use Grid Search and Heatmap to test parameter sensitivity, and Walk-Forward to check it holds out of sample.
- Save a working strategy to the Strategy Library for later.
Backtesting is historical only. It does not connect to your broker or place any trades. Once a strategy checks out, rebuild it in the Strategy Builder for live execution.
The other tabs
| Tab | What it does |
|---|---|
| Strategy Library | Save, organise in folders, and reload strategy configurations. |
| Grid Search | Sweep one parameter across a range and compare the results. |
| Heatmap | Sweep two parameters at once, shown as a colour grid. |
| Comparison | Put several backtest runs side by side. |
| Walk-Forward | In-sample and out-of-sample rolling validation. |
| Portfolio | Combine multiple strategies into one equity curve. |
There are also post-run panels on a finished backtest: a market regime overlay that splits results by trending versus range-bound periods, and a Monte Carlo panel that reshuffles the trade sequence to show a range of possible drawdowns.
Limitations to know
- NIFTY and BANKNIFTY only for now.
- One-minute bars, not ticks. Intrabar stop and target fills, and live-LTP momentum checks, are approximated from the bar high and low.
- No costs modelled. Brokerage, slippage and market impact are not included, so live results will be lower.
- BTST and positional range-breakout variants are not yet supported by the engine.
Frequently asked questions
What is options strategy backtesting?
Which instruments can I backtest in Stolo?
What kinds of strategies can I build?
How does strike selection work?
Can I add stop loss and re-entry rules?
What are lazy legs?
What statistics does the backtest report?
What is the Grid Search tab for?
What is walk-forward testing?
How accurate is the backtest?
Can I save strategies to reuse?
Does backtesting place any live trades?
What plan do I need to use the backtest tool?
Test the strategy before you trade it
Backtest multi-leg NIFTY and BANKNIFTY options strategies over any date range in Stolo, with full stats and a trade log.
Start with the Trial Plan at just ₹299
