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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。