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)
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。