Skip to content

moravsky/orb-quantower

Repository files navigation

OpeningRangeBreakout

Platform .NET Runtime

Trade the first breakout of the session's opening range, sized to your exact risk per trade.

A paired Quantower indicator and strategy implementing the Opening Range Breakout (ORB) pattern: the indicator plots the OR high/low and the breakout extension lines on the chart, and the strategy takes the first breakout of either side with a stop on the opposite extension and a take-profit at your configured R-multiple.

ORB-Replay.mp4

Features

  • Chart-first indicator -- OR high, OR low, and the two extension trigger lines render as standard line series. Usable on its own without the strategy.
  • First-breakout-only entries -- one trade per session, the first time price closes beyond either extension trigger. Subsequent same-direction or opposite-direction breaks in the same session are ignored.
  • Risk-based position sizing -- contract count is derived from account balance, configured risk percent, and the stop distance from entry to the opposite extension line. No fixed-quantity setting.
  • Market or Limit entry -- pick how the breakout is executed:
    • Market fills at the next bar after the trigger close.
    • Limit rests at the OR boundary, so you only get filled on a pullback into the range.
  • Configurable breakout extension -- a percent-of-OR-width buffer above the OR high and below the OR low. The strategy waits for a close beyond the extension, not just a wick through the range, and uses the opposite extension as the stop.
  • Bracket on entry -- stop loss and take profit are attached to the entry order as a single bracket; no separate order placement step.
  • Session-aware -- the OR is rebuilt each UTC day; entries are gated to the configured intraday window (after the OR closes, before the last-entry time).
  • Testable core -- range math, breakout decisions, and sizing live in plain classes (OpeningRangeEngine, BreakoutDecider, RiskCalculator) exercised by an xUnit test suite that never touches Quantower types.

Requirements

To run:

  • Quantower v1.145.17+ with an active connection (any futures broker)
  • Windows 10+ x64
  • .NET 8 x64 Runtime (bundled with Quantower)

To build from source:

  • .NET 8 x64 SDK
  • PowerShell (for deploy.ps1)

Installation

Build from source and deploy with the included script.

git clone https://github.com/moravsky/orb-quantower.git
cd orb-quantower
dotnet build OpeningRangeBreakout.sln -c Release
.\deploy.ps1 -Config Release

deploy.ps1 copies the built DLLs into the appropriate Quantower scripts folders:

  • Indicator -> C:\Quantower\Settings\Scripts\Indicators\OpeningRangeBreakout.Indicator
  • Strategy -> C:\Quantower\Settings\Scripts\Strategies\OpeningRangeBreakout.Strategy

Default mapping is Release -> Prod (C:\Quantower) and Debug -> Dev (C:\QuantowerDev). Override with -Target Dev|Prod, or deploy only one side with -Project Indicator|Strategy. Restart Quantower after deploying.


Disclaimer

This project is a reference implementation for developers building Quantower strategies, not a plug-and-play trading system. ORB as a strategy requires tuning to your instrument, session, and risk tolerance. Before running with real money:

  • Use Market Replay to test different window/extension/RR combinations on historical data.
  • Run the backtester to evaluate performance across a range of dates and parameter sweeps.
  • Understand the sizing math -- a wide OR on NQ at 1% risk might yield zero contracts; a narrow OR on MNQ at 20% might yield more than you expect.
  • Review stop and target placement -- the defaults are just a starting point.

Quick Start

With Market Replay (recommended)

  1. Open Quantower and start Market Replay on your instrument.
  2. Start replay, then pause -- the replay account and symbol now exist.
  3. Go to Strategies Manager -> find Opening Range Breakout -> configure settings:
    • Symbol and Account -- select the replay symbol and account
    • OR window start and OR window duration (in UTC; display reflects your chart timezone)
    • Last entry time (the strategy ignores breakouts after this)
    • Risk per trade and Risk:Reward ratio
  4. Start the strategy.
  5. In Market Replay, click Visualizer -> Chart to open the replay chart.
  6. (Optional) Add the OpeningRange indicator to the chart to see the range and triggers.
  7. Resume replay and watch the strategy log and chart as the OR forms and breaks.

Settings Reference

Strategy

Setting Description
Symbol Instrument to trade
Account Account to place orders against (must share a connection with Symbol)
Bar period Bar size used for breakout decisions. Defaults to 1-minute
OR window start UTC time when the opening-range window begins
OR window duration Length of the opening-range window in minutes. Default 15
Last entry time UTC cutoff time -- no new entries after this
Risk per trade Percentage of account balance risked per trade. Default 1.0
Risk:Reward ratio Target distance as a multiple of stop distance. Default 2.0
Max contracts Upper limit on position size; 0 means no cap
Breakout extension Extension beyond OR high/low as a percentage of the range width. Default 10.0
Entry order type Market enters at current price; Limit enters at OR boundary. Default Limit

Indicator

Setting Description
Window start time UTC time when the opening-range window begins
Window duration Length of the opening-range window in minutes
Breakout extension Extension beyond OR high/low as a percentage of the range width

The indicator and the strategy maintain independent instances -- set them on both if you want the chart to match what the strategy is trading.


How It Works

Opening Range

For each trading day, the engine tracks the high and low across every closed bar that falls inside [OR window start, OR window start + OR window duration). After the window closes, the OR high and OR low are frozen for the rest of the session, then reset on the next trading day.

Extension and Triggers

The extension is a percent of the OR width applied symmetrically:

extension    = (OR high - OR low) * (extension percent / 100)
high trigger = OR high + extension
low trigger  = OR low  - extension

The two trigger lines are what the strategy actually breaks out from, not the OR itself. A wick through the OR that does not close beyond a trigger is ignored.

Entry, Stop, and Target

On the first bar that closes beyond a trigger after the OR window has ended (and before the last-entry time):

  • Side -- long if it closed above the high trigger, short if below the low trigger.
  • Stop -- the opposite trigger line. A long stops at the low trigger; a short stops at the high trigger.
  • Entry -- the bar's close for Market, or the OR boundary for Limit (OR high for longs, OR low for shorts).
  • Target -- entry plus/minus (entry - stop) * RiskRewardRatio in the direction of the trade.

The entry order is placed with stop loss and take profit attached as a bracket. Only the first qualifying breakout per session is taken; later breakouts the same day are ignored regardless of direction.

Position Sizing

cost per contract = (stop distance / tick size) * tick value
position risk     = account balance * (risk percent / 100)
contracts         = floor(position risk / cost per contract)

Stop distance is measured from the entry price to the stop, not from the breakout close. If Max contracts is set, the result is clamped down to that cap. A computed quantity of zero (stop too wide for the risk budget) skips the entry and logs an error.


Project Layout

Project Role
OpeningRangeBreakout.Indicator Quantower chart indicator. Contains OpeningRangeEngine (range math) and plots OR + extension lines
OpeningRangeBreakout.Strategy Quantower strategy shell. Attaches the indicator, reads levels via GetValue, and wires decider -> sizing -> order placement
OpeningRangeBreakout.Test xUnit tests for the engine, decider, and risk calculator
dotnet test OpeningRangeBreakout.Test/OpeningRangeBreakout.Test.csproj

See TESTING.md for the manual E2E checklist (Market Replay scenarios) and ARCHITECTURE.md for detailed data flow, wiring, and design decisions.


Author

Petr Moravsky (petr@structuredtrading.co) -- futures trader and developer.

If OpeningRangeBreakout helped you build a strategy or served as a reference for your own development -- star the repo and leave a tip.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors