Backtesting

Opening range breakout: how to backtest it on NIFTY options

How the opening range breakout works, why the range length and breakout count matter, and how to backtest it on NIFTY or SENSEX options with fills and charges.

By
Veloce team
Published
Reading time
9 min read
On this page
  1. How the opening range is defined
  2. The candle has to fit the range
  3. A breakout, candle by candle
  4. Turning the signal into option trades
  5. The worked morning in rupees
  6. The questions traders ask about ORB
  7. Reading an ORB backtest
  8. Setting up the test
  9. Sweeping the range and the breakout count
  10. A checklist for an honest ORB test
  11. Try it in Veloce

An opening range breakout (ORB) waits for the first minutes of the session to set a high and a low, then trades in the direction of the first candle that closes outside that range. To backtest it honestly, build the range only from candles that have closed, count a breakout on a candle close rather than a wick, fill at the next candle’s open, decide in advance how many breakouts a day you will act on, and charge both sides of every trade. On NIFTY options there is one more effect: the option you buy loses time value while you wait for the move to continue. This guide works through a breakout candle by candle with Veloce’s own signal code, then shows how to set up and sweep the test.

How the opening range is defined

The opening range is the highest high and the lowest low of the candles that start in the first n minutes after the session opens. For NSE and BSE index options the session opens at 09:15, so a 15-minute range covers the candles from 09:15 to 09:30.

Three choices define the rule:

Choice Common values What it changes
Range length 5, 15, 30, 60 minutes How wide the range is and how early a breakout can happen
Candle size 1, 3, 5, 15 minutes How quickly a breakout is recognised and how many false ones appear
Breakouts per day 1 or 2 Whether a reversal through the other side is traded

The range is built from highs and lows, but the breakout is judged on the close. A candle whose wick pokes above the range high and closes back inside is not a breakout.

The candle has to fit the range

The candles must divide the range evenly. With a 15-minute range, 5-minute candles end exactly at 09:30; 10-minute candles do not (the 09:25 candle would run to 09:35, half inside the range and half outside). Veloce rejects that combination with an error rather than guessing which half the candle belongs to:

a 0:10:00 candle at 2026-11-17 09:25:00+05:30 straddles the opening range end at 09:30:00

This matters in a sweep: if you vary the candle size and the range length together, some pairs will be skipped. That is correct behaviour, not a bug.

A breakout, candle by candle

Here is one illustrative morning of 5-minute NIFTY candles, run through Veloce’s opening-range code with a 15-minute range. The prices are invented for the example; the signal column is what the code returned.

Candle Closes at High Low Close Signal (1 breakout) Signal (2 breakouts)
09:15 09:20 25,938 25,884 25,921 building range building range
09:20 09:25 25,930 25,872 25,880 building range building range
09:25 09:30 25,912 25,876 25,905 building range building range
09:30 09:35 25,935 25,899 25,931 inside inside
09:35 09:40 25,952 25,926 25,947 bullish bullish
09:40 09:45 25,960 25,940 25,955 no change no change
09:45 09:50 25,958 25,860 25,866 ignored bearish
09:50 09:55 25,880 25,850 25,858 no change no change

The range is 25,872 to 25,938: the highest high and lowest low of the three candles that started before 09:30.

Things to notice:

  1. The 09:30 candle is not a breakout. Its high (25,935) stayed below the range high, and its close is inside.
  2. The 09:35 candle closes above 25,938. Its close at 09:40 is the first moment anyone could know the breakout happened.
  3. A second close above the high is not a new signal. The 09:40 candle closes above the range too, but the direction has not changed.
  4. The reversal depends on the setting. The 09:45 candle closes at 25,866, below the range low. With one breakout a day the signal ignores it. With two it turns bearish.

The range and the breakout count reset at the start of each day.

25,938 25,872 opening range, 09:15 to 09:30 closes above: bullish closes below: bearish if 2 allowed
The range is set by highs and lows; breakouts are judged on closes. Prices are illustrative.

Turning the signal into option trades

Veloce’s built-in ORB option buyer trades the signal on NIFTY, BANK NIFTY or SENSEX options:

Setting Default
Opening range 15 minutes from 09:15
Candle 5 minutes
Breakouts per day 1
Bullish breakout Buy one lot of the at-the-money call, nearest expiry
Bearish breakout Close the call if held, buy one lot of the at-the-money put
Entries Candles closing from 09:15 to 15:00
Signal cutoff Index candles closing after 15:15 are ignored
Square off Everything is closed at 15:15
Stop, target, trailing stop Off unless set

The at-the-money strike is the index close rounded to the nearest strike step: 25,947 rounds to the 25,950 call, and 25,866 to the 25,850 put.

The worked morning in rupees

Continuing the illustrative morning, with Veloce’s one-tick slippage and NSE option charges for November 2026 (NIFTY lot of 65; premiums illustrative):

One breakout a day. The bullish close at 09:40 buys the 25,950 call at its 09:40 open of ₹120.00, filled at ₹120.05. The reversal is ignored. The call is sold at the 15:15 square off at ₹142.00, filled at ₹141.95.

Fill Price Charges
Buy 25,950 call ₹120.05 ₹27.11
Sell at square off ₹141.95 ₹41.32

Result: (141.95 − 120.05) × 65 = ₹1,423.50, less ₹68.43 in charges, ₹1,355.07.

Two breakouts a day. The same call is bought at ₹120.05. The bearish close at 09:50 sells it at its next open of ₹92.00 (filled ₹91.95) and buys the 25,850 put at ₹98.00 (filled ₹98.05). The market recovers and the put is sold at the square off at ₹74.95.

Trade Price result Charges Net
Call: ₹120.05 to ₹91.95 −₹1,826.50 ₹62.19 −₹1,888.69
Put: ₹98.05 to ₹74.95 −₹1,501.50 ₹59.43 −₹1,560.93
Day −₹3,449.62

Same candles, same strategy, one setting different: a gain of ₹1,355.07 or a loss of ₹3,449.62. On a different day (a clean reversal that keeps going) the second setting would win. That is the point of a backtest: count how often each kind of day occurs over months, rather than judging from one chart.

Charges and slippage on a round trip in an at-the-money NIFTY option near ₹100 to ₹140 come to roughly ₹65 to ₹75 per lot. A strategy that takes two round trips on most days pays about ₹140 per lot per day before the market has moved.

The questions traders ask about ORB

Does the range have to start at 09:15? No. Some traders skip the first candle because it carries the opening gap and pre-open orders. In a strategy spec, the session open is a setting, so a range from 09:20 to 09:35 is a valid test. For MCX gold futures, set it to 09:00, the commodity session’s open.

What about the gap? On a gap day, the opening range forms after the gap, so it measures the first minutes of trading at the new level. A large gap often produces a wide range, which breaks later or not at all. Read the results by gap size: if most of the profit comes from gap days, the strategy is really a gap strategy.

Should I filter by the width of the range? A very narrow range breaks on noise; a very wide one leaves no room. Filtering is reasonable, but every filter is another setting to tune. Start with the plain rule and see where it fails before adding any.

Should I take the trade on expiry day? An at-the-money weekly option on expiry day has little time value left, so it behaves almost like the index with a high cost of being wrong. The buyer’s minimum days to expiry setting skips entries when the nearest expiry is too close; compare results with 0 (trade every day) and 1 (skip expiry day).

How late is too late for a breakout? A breakout at 14:45 has thirty minutes before the square off. The last entry time limits that: compare 15:00 with 13:00 and see how many late breakouts paid for themselves.

Reading an ORB backtest

Breakout rules tend to have a modest win rate and rely on the days when the move continues. Read these together:

  • Win rate with average win against average loss. A 40% win rate is fine if winners are twice the size of losers.
  • Exit reasons. Veloce labels each closed trade: the opposite signal, the 15:15 square off, or a stop. With one breakout a day, most trades end at the square off, so the result depends on where the market is at 15:15. With two, look at how many trades were closed by the reversal.
  • Time of entry. Group trades by the hour they opened. Breakouts in the first hour behave differently from those after lunch.
  • Days with no trade. Some days never close outside the range. Count them; a strategy that trades on 60% of days has fewer samples than its period suggests.
  • Charges as a share of gross profit. If charges take more than a third of what the trades made before costs, the strategy is fragile to any change in slippage.
  • Maximum drawdown and its length. Breakout strategies can go weeks without a good trend day. The drawdown guide covers how to size for that.

Setting up the test

As a strategy spec, the default buyer with a later first entry, an earlier last entry and a 30% stop on the premium paid looks like this:

{
  "name": "nifty-orb-buyer",
  "candle_minutes": 5,
  "entry": {
    "signal": { "kind": "opening_range_breakout", "range_minutes": 15, "max_signals": 1 },
    "signal_cutoff": "15:15",
    "first_entry": "09:30",
    "last_entry": "13:00"
  },
  "legs": [{ "kind": "option", "option_type": "call", "side": "buy" }],
  "bearish_legs": [{ "kind": "option", "option_type": "put", "side": "buy" }],
  "square_off": "15:15",
  "exits": { "rules": [{ "kind": "stop_loss", "amount": { "kind": "share_of_cost", "fraction": "0.3" } }] },
  "risk": { "rules": [{ "kind": "cash" }] }
}

The session_open field defaults to 09:15 and can be set for other markets. The strategy spec guide explains each field.

Sweeping the range and the breakout count

A sweep shows how sensitive the result is to the settings:

Sweep input Values
Tuning period April 1 to August 31, 2026
Check until October 31, 2026
Range 15 minutes, 30 minutes
Breakouts per day 1, 2
Candle 3 minutes, 5 minutes
Settings to check Best 3

That is eight combinations: a 15 or 30 minute range, one or two breakouts a day, and a 3 or 5 minute candle, ranked by net P&L on the tuning period, with the best three run again on September and October. Read the result for:

  • Plateaus. If both range lengths work with one breakout and fail with two, the reversal rule is what matters.
  • Trade counts. Two breakouts and short candles trade more. Compare charges across rows.
  • Check-period decay. The best tuning result usually falls on the check period. The walk-forward guide explains what a single held-back period can and cannot show.

A checklist for an honest ORB test

Check Why
Build the range only from closed candles The range is not known until 09:30
Judge breakouts on the close A wick through the range is not a tradable signal
Fill at the next candle’s open Avoids trading at the price that created the signal
Make the candle fit the range A candle across the range end belongs to neither part
Decide the breakout count in advance and test both Reversals change the result completely
Replay option prices, not the index Time decay and delta change the outcome
Fix the lot size for the period NIFTY went from 75 to 65 per lot from January 2026 expiries
Tune on one period, check on a later one The best range in hindsight is partly luck

Try it in Veloce

Veloce backtests the opening range breakout on NIFTY 50 weekly, BANK NIFTY monthly and SENSEX weekly options, and on MCX gold and gold mini futures through a spec, all on one-minute data with next-open fills and itemised charges. The ORB buyer is a built-in strategy, sweeps vary the range, candle and breakout count with a held-back check period, and the risk and exits page covers stops and square offs.

Create a free Veloce account and run the 15-minute breakout over your own period. For other intraday signals, see the moving average crossover guide and the Supertrend and RSI guide.

Frequently asked questions

What is an opening range breakout strategy?
A rule that records the high and low of the first minutes of the session, the opening range, and then turns bullish when a later candle closes above the range high or bearish when one closes below the range low. The range length, the candle size and how many breakouts to act on are all settings to test.
Is a 15-minute or 30-minute opening range better for NIFTY?
Neither is better in general. A 15-minute range is narrower, so it breaks more often and earlier, with more false breakouts. A 30-minute range breaks less often and later, leaving less of the day for the move. Test both on the same period with charges and confirm the choice on a later period.
Should the breakout be a candle close or a touch of the range?
A touch can be acted on in real time but is hard to backtest honestly with candles, because the candle that touched may also have reversed. Veloce uses the close: a breakout counts only when a candle closes beyond the range, and the order fills at the next candle's open.
What happens when NIFTY breaks out one way and then reverses?
That depends on how many breakouts you allow per day. With one, the strategy keeps the first trade and ignores the reversal. With two or more, a close beyond the other side of the range closes the first trade and opens one in the new direction. Testing both settings shows how often reversals happen.
Should I trade the breakout with options or futures?
Options limit the loss to the premium paid but lose time value while the move develops, and an at-the-money option moves roughly half as much as the index at first. A backtest should replay recorded option prices, not infer them from the index.
Can I backtest an opening range breakout on gold futures?
Yes. The breakout signal takes a session open time, so for MCX gold futures, whose session opens at 09:00, you set the session open to 09:00 in a strategy spec and trade the future long and short.

Sources

  1. Marketcalls: 15 minute opening range breakoutmarketcalls.in, accessed
  2. Option Alpha: Opening range breakout 0DTE options trading strategy explainedoptionalpha.com, accessed
  3. NSE circular NSE/FAOP/70616: revision in market lot of derivative contracts on indices (October 3, 2025)nsearchives.nseindia.com, accessed
  4. Union Budget 2026-27, Memorandum explaining the provisions of the Finance Bill (STT on options and futures)indiabudget.gov.in, accessed
esc
↑↓Move↵Open