OPEN-SOURCE SCRIPT
Session Opening Range Breakout (ORBO)

This strategy automates a classic Opening Range Breakout (ORBO) approach: it builds a price range for the first minutes after the market opens, then looks for strong breakouts above or below that range to catch early directional moves.
Concept
The idea behind ORBO is simple:
This script turns that logic into a fully backtestable strategy in TradingView.
How the strategy works
Opening Range Session
This forms your Opening Range for the day.
Breakout Logic (after the window ends)
Once the defined session ends:
Long Entry:
If the close crosses above the Opening Range High (orHigh),
Short Entry:
If the close crosses below the Opening Range Low (orLow),
Only one opening range per day is considered, which keeps the logic clean and easy to interpret.
Daily Reset
This ensures entries are always based on today’s structure, not yesterday’s.
Visuals & Inputs
Inputs:
Chart visuals:
These visuals make it easy to see:
Backtesting & Optimization
Because this is written as a strategy():
You can use TradingView’s Strategy Tester to view:
Ideas to experiment with:
Add your own:
Concept
The idea behind ORBO is simple:
- The first minutes after the session open are often highly informative.
- Price forms an “opening range” that acts as a mini support/resistance zone.
- A clean breakout beyond this zone can lead to high-momentum moves.
This script turns that logic into a fully backtestable strategy in TradingView.
How the strategy works
Opening Range Session
- Default session: 09:30–09:50 (exchange time)
- During this window, the script tracks:
- orHigh → highest high within the session
- orLow → lowest low within the session
This forms your Opening Range for the day.
Breakout Logic (after the window ends)
Once the defined session ends:
Long Entry:
If the close crosses above the Opening Range High (orHigh),
→ strategy.entry("OR Long", strategy.long) is triggered.
Short Entry:
If the close crosses below the Opening Range Low (orLow),
→ strategy.entry("OR Short", strategy.short) is triggered.
Only one opening range per day is considered, which keeps the logic clean and easy to interpret.
Daily Reset
- At the start of a new trading day, the script resets:
- orHigh := na
- orLow := na
- A fresh Opening Range is then built using the next session’s 09:30–09:50 candles.
This ensures entries are always based on today’s structure, not yesterday’s.
Visuals & Inputs
Inputs:
- Opening range session → default: "0930-0950"
- Show OR levels → toggle visibility of OR High / Low lines
- Fill range body → optional shaded zone between OR High and OR Low
Chart visuals:
- A green line marks the Opening Range High.
- A red line marks the Opening Range Low.
- Optional yellow fill highlights the entire OR zone.
- Background shading during the session shows when the range is currently being built.
These visuals make it easy to see:
- Where the OR sits relative to current price
- How clean / noisy the breakout was
- How often price respects or rejects the opening zone
Backtesting & Optimization
Because this is written as a strategy():
You can use TradingView’s Strategy Tester to view:
- Win rate
- Net profit
- Drawdown
- Profit factor
- Equity curve
Ideas to experiment with:
- Change the session window (e.g., 09:15–09:45, 10:00–10:30)
- Apply to different:
- Markets: indices, FX, crypto, stocks
- Timeframes: 1m / 5m / 15m
Add your own:
- Stop Loss & Take Profit levels
- Time filters (only trade certain days / times)
- Volatility filters (e.g., ATR, range size thresholds)
- Higher-timeframe trend filter (e.g., only take longs above 200 EMA)
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.