Tutorials9 min read2026-09-17

How to Backtest an Opening Range Breakout Strategy

A step-by-step method to backtest an opening range breakout (ORB) strategy: session and range rules, entries and exits, fill models, optimization and demo testing.

Roboquant

Roboquant Team

Trading Automation Experts

opening range breakoutorbbacktestingday tradingstrategy rules
How to Backtest an Opening Range Breakout Strategy

What an Opening Range Breakout Strategy Is

An opening range breakout (ORB) strategy marks the high and low of the first few minutes after a session opens, then trades when price breaks out of that range. The idea is simple enough to describe in one sentence. Backtesting it honestly is harder, because that one sentence hides a dozen decisions, and each one changes the trades.

This guide walks through those decisions in order, using the 15-minute opening range as the running example. It works for any market with a defined session; only the session times change.

Step 1: Define the Session Open

Some markets trade nearly around the clock, so "the open" is a choice, not a given. A common reference for US stock index markets is 9:30 New York time, the US cash equity open. Other markets have their own reference times; check the exchange's trading-hours page for the market you test.

Two details break many ORB backtests:

  • Timezone and daylight saving time. Write the rule in the exchange's local time, with daylight saving time handled. A rule written as a fixed UTC time shifts by an hour for part of the year.
  • Holidays and early closes. A shortened session can skip your time-based exit entirely. Decide what the strategy does on those days.

Step 2: Define the Range

For a 15-minute opening range starting at 9:30, the range is the highest high and lowest low from 9:30 to 9:45.

Watch the bar timestamps. Many platforms, Roboquant included, stamp a bar with its open time. On 5-minute bars, the 15-minute range is the bars stamped 9:30, 9:35 and 9:40, and it's complete when the 9:40 bar closes at 9:45. Including the bar stamped 9:45 uses prices from after the range ended. That off-by-one bar is look-ahead bias, and it makes results look better than they could ever be live. Look-Ahead Bias in Backtesting: 7 Real Examples covers this and other leaks.

Also:

  • Use a bar size that divides the range evenly. 1-, 3- or 5-minute bars for a 15-minute range, not 10-minute bars.
  • Make the range length a parameter (for example 5, 15, 30 or 60 minutes) so you can test it rather than assume it.

Step 3: Define the Entry

There are two common entries, and they need different data to test honestly:

EntryHow it worksData needed
Stop order at the rangeBuy stop just above the range high, sell stop just below the range lowTick data: the fill happens inside a bar
Close outside the rangeWait for a bar to close beyond the range, then enter at marketBar data is fine: the decision is at bar close

The stop entry gets in earlier but fills during fast moves, often worse than the stop price. The bar-close entry is simpler to test but enters later, at a worse price on strong breakouts.

Then decide:

  • Direction: long only, short only, or both.
  • Buffer: how many ticks beyond the range the entry sits, to filter touches.
  • Trades per day: one, or a re-entry after a failed breakout.
  • Both sides in one bar: if price breaks the high and the low in the same bar, what happens? Bar data can't tell you which came first.
  • Entry cutoff: no new entries after a set time, for example late morning.

Step 4: Define the Exits

Every ORB needs three exits:

  • Stop: the opposite side of the range, the range midpoint, or a fixed distance.
  • Target: a multiple of the range width, a fixed distance, or none.
  • Time exit: flat by a fixed time before the session ends, so no position is carried overnight by accident.

A hypothetical example with simple numbers, not taken from any real market: the range high is 104.00 and the low is 100.00, so the range is 4.00 wide. A long stop entry sits at 104.25, one tick (0.25) above the high. With the stop at the midpoint, 102.00, the risk is 2.25 points per contract. A target of one range width above the entry is 108.25, which is 4.00 points of potential gain for 2.25 points of risk.

If the stop and the target are both touched in one bar, a bar backtest has to guess which came first. With stops as tight as a range midpoint, that happens often enough to matter. See Tick vs Bar Backtesting.

Step 5: Add Filters Sparingly

Common ORB filters:

  • Range width: skip days where the range is unusually narrow or unusually wide compared with recent daily ranges.
  • Scheduled news: skip days with major releases near the open.
  • Trend context: trade only in the direction of a higher-timeframe trend.

Each filter is another parameter the optimizer can fit to noise. Add one at a time, and keep it only if it helps on data you didn't tune it on.

Step 6: Write the Rules as a Spec

Put every decision into one description. Every tunable value becomes a parameter:

ParameterExample value
Session open9:30 New York time
Range length15 minutes
Entry typeStop order beyond the range
Buffer1 tick
DirectionLong and short
StopRange midpoint
Target1× range width
Max trades per day1
Entry cutoff11:00 New York time
Flat time15:55 New York time

In Roboquant, you can paste a spec like this into the chat:

"Build an opening range breakout strategy on 5-minute bars. The range is the high and low of the bars from 9:30 to 9:45 New York time, handling daylight saving time; it is complete when the 9:40 bar closes. After that, place a buy stop 1 tick above the range high and a sell stop 1 tick below the range low; when one fills, cancel the other. Stop loss at the range midpoint, take profit at one range width from entry. One trade per day, no new entries after 11:00, flat by 15:55. Make range length, buffer ticks, target multiple, entry cutoff and flat time parameters. Draw the opening range on the chart. List any assumptions before writing the strategy."

On Starter and higher, the AI writes a compiled .rq strategy, compiles it and repairs any errors before saving; the Free plan includes a guided builder. The rules map onto documented building blocks: Eastern-time helpers for the session, stop orders with attached stop loss and take profit, and one-cancels-other groups. The runtime reference lists them. Compiling proves the code is valid, not that it matches your rules, so the next steps check the trades.

Step 7: Choose Data, Fill Model and Costs

  • Stop entries, midpoint stops, tight targets: use tick fills, so entries, stops and targets follow the trade tape.
  • Bar-close entries with wide exits: OHLCV bars are usually enough.
  • Compare both. Run the same strategy on bars and ticks with nothing else changed. A large difference means the bar result depended on intrabar guesses.
  • Costs: set commission per side and slippage. Breakout entries fill in fast moves, so don't assume zero slippage on the entry.

In Roboquant, tick-level fills start on Starter, and tick data covers supported symbols and dates. History depth depends on your plan.

Step 8: Run It, Then Read the Trades

Don't stop at the summary. Pick several days and check them on the chart:

  • Is the drawn range the right high and low for the right bars?
  • Did the entry happen after the range completed, never during it?
  • Did the opposite order cancel when one side filled?
  • Did the time exit fire on shortened sessions?

In Roboquant, Replay streams the run on the chart with trades, stop and target rails and drawings. On a tick run, entries and exits appear at their real point inside the candle. The Free plan includes a Replay preview; full Replay starts on Starter. Then look at the numbers: trade count, average trade after costs, maximum drawdown and profit factor. Understanding Sharpe Ratio, Drawdown & Key Metrics explains each one.

Step 9: Optimize Without Fooling Yourself

ORB strategies have few natural parameters, which makes them easy to overfit if you sweep everything at once.

  • Use coarse ranges for range length, buffer and target multiple.
  • Look for plateaus. A region where many neighbouring values perform similarly is more trustworthy than one sharp peak.
  • Validate out of sample. Optimize on the first part of the history and check the untouched remainder, or use walk-forward validation.
  • Check other markets. Evaluating the same parameters on several markets shows whether the rule is robust or fitted to one market's history.
  • Rerun the chosen parameters as a normal backtest before you rely on them.

In Roboquant, optimization starts on Pro with in-sample/out-of-sample validation. Walk-forward validation starts on Elite, and checks across several markets depend on your plan.

Step 10: Forward Test on a Demo Account

A backtest can't show you how breakout entries fill in today's market. Run the strategy on a demo account, then backtest the same days with the same settings and compare trade by trade. Why Your Backtest Doesn't Match Live Trading covers how to read the differences.

In Roboquant, you deploy the same compiled strategy to a Tradovate Demo account, then Live, with limits on order size, position size and daily loss. Native deployments start on Pro. See pricing.

Common ORB Backtest Mistakes

  • Including the bar that starts at the end of the range
  • Session times written in UTC, drifting an hour with daylight saving time
  • Testing stop entries on bar data only
  • No slippage on breakout entries
  • Both sides filling on a whipsaw day because the other order never cancelled
  • No time exit, or one that never fires on early closes
  • Optimizing range length, buffer, target and filters all at once on the full history

Related Reading

Try It

Describe your opening range rules in the chat and backtest them on bars and ticks.

Start building · See pricing

Trading involves risk of loss. Backtest results are hypothetical and do not guarantee future performance.

Share this article:

Build Your Next Strategy with Roboquant

Chat an idea into a strategy, then backtest, optimize and deploy it live. All in one place.