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)
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.