OPEN-SOURCE SCRIPT
Updated Opening Range Breakout (ORB) with Fib Retracement

Overview
“ORB with Fib Retracement” is a Pine Script indicator that anchors a full Fibonacci framework to the first minutes of the trading day (the opening-range breakout, or ORB).
After the ORB window closes the script:
Locks-in that session’s high and low.
Calculates a complete ladder of Fibonacci retracement levels between them (0 → 100 %).
Projects symmetric extension levels above and below the range (±1.618, ±2.618, ±3.618, ±4.618 by default).
Sub-divides every extension slice with additional 23.6 %, 38.2 %, 50 %, 61.8 % and 78.6 % mid-lines so each “zone” has its own inner fib grid.
Plots the whole structure and—optionally—extends every line into the future for ongoing reference.
“ORB with Fib Retracement” is a Pine Script indicator that anchors a full Fibonacci framework to the first minutes of the trading day (the opening-range breakout, or ORB).
After the ORB window closes the script:
Locks-in that session’s high and low.
Calculates a complete ladder of Fibonacci retracement levels between them (0 → 100 %).
Projects symmetric extension levels above and below the range (±1.618, ±2.618, ±3.618, ±4.618 by default).
Sub-divides every extension slice with additional 23.6 %, 38.2 %, 50 %, 61.8 % and 78.6 % mid-lines so each “zone” has its own inner fib grid.
Plots the whole structure and—optionally—extends every line into the future for ongoing reference.
- **Session time / timezone** – Defines the ORB window (defaults 09:30–09:45 EST).
- **Show All Fib Levels** – Toggles every retracement and extension line on or off.
- **Show Extended Lines** – Draws dotted, extend-right projections of every level.
- **Color group** – Assigns colors to buy-side (green), sell-side (red), and internal fibs (gray).
- **Extension value inputs** – Allows custom +/- 1.618 to 4.618 fib levels for personalized projection zones.
Release Notes
minorRelease Notes
Added all necessary half-hour offsets (e.g., GMT+5:30, GMT-3:30) to the existing full-hour GMT list, covering the full range from GMT-12 to GMT+14. This allows for accurate session alignment in regions with 30-minute time differences.Release Notes
- [B]What makes this tool different[/B] – Most ORB scripts stop at the breakout line or show a single-direction retracement. This one builds a [B]complete, symmetrical Fibonacci “ladder”[/B] (0 → 4.618 and −0 → −4.618) from the opening-range high and low, so traders can read both pull-backs and extensions with the same visual grammar.
- [B]Core idea[/B] – Price often “respects” the opening 15-minute range; measuring every Fib proportion above [I]and[/I] below that zone creates objective checkpoints for intraday continuation, fade and mean-reversion plays.
- [B]How the maths work[/B]
• Session picker grabs your custom window (default 09 : 30–09 : 45 New-York).
• First bar after the window freezes the range; subsequent bars update a cached [I]finalTop/finalLow[/I].
• A single array holds the positive and negative Fib coefficients.
• A helper routine translates each coefficient into an absolute price, returning eight nested “rings” of levels (both sides of the range, plus mid-steps between the 1×, 1.618×, 2.618×, 3.618×, 4.618× zones).
• Optional extender draws the same prices straight through to the next trading day, so you can see whether a level “matters” hours later. - [B]Visual logic[/B] – Green levels = upside targets; red = downside; grey = neutral Fib (23.6 → 78.6 %). Turn off “Show All Fib levels” if you only want the range and the ±1.618 “sweet-spot”.
- [B]Inputs you can tweak[/B]
• [I]Range[/I] & [I]Zone[/I] – any session / any timezone.
• Individual Fib coefficients for 1.618 → 4.618 and −1.618 → −4.618 (leave blank to disable).
• Two visibility switches: showAllLevels (on-chart clutter control) and showExtendedLines (project to next day).
• Three colour pickers for fast palette changes. - [B]Practical ways to trade it[/B]
• [I]Momentum breakout[/I] – wait for a candle close beyond ±1 × range, then trail partials at 1.618 / 2.618.
• [I]Fade the extremes[/I] – look for exhaustion signals at 3.618 / 4.618; stop outside the furthest band.
• [I]Reversion ladder[/I] – when price drops back inside the range, scale in/out at the grey Fib rungs.
• Pair with volume or oscillator divergence to filter false prints. - [B]Best-practice tips[/B] – Works on any intraday symbol but the structure is most reliable on liquid equities, index futures and majors. For very fast charts (<1 min) tighten the session (e.g., 09 : 30–09 : 35) to avoid level congestion.
Release Notes
- What makes this tool different – Most ORB scripts stop at the breakout line or show a single-direction retracement. This one builds a complete, symmetrical Fibonacci “ladder” (0 → 4.618 and −0 → −4.618) from the opening-range high and low, so traders can read both pull-backs and extensions with the same visual grammar.
- Core idea – Price often “respects” the opening 15-minute range; measuring every Fib proportion above and below that zone creates objective checkpoints for intraday continuation, fade and mean-reversion plays.
- How the maths work
• Session picker grabs your custom window (default 09 : 30–09 : 45 New-York).
• First bar after the window freezes the range; subsequent bars update a cached finalTop/finalLow.
• A single array holds the positive and negative Fib coefficients.
• A helper routine translates each coefficient into an absolute price, returning eight nested “rings” of levels (both sides of the range, plus mid-steps between the 1×, 1.618×, 2.618×, 3.618×, 4.618× zones).
• Optional extender draws the same prices straight through to the next trading day, so you can see whether a level “matters” hours later. - Visual logic – Green levels = upside targets; red = downside; grey = neutral Fib (23.6 → 78.6 %). Turn off “Show All Fib levels” if you only want the range and the ±1.618 “sweet-spot”.
- Inputs you can tweak
• Range & Zone – any session / any timezone.
• Individual Fib coefficients for 1.618 → 4.618 and −1.618 → −4.618 (leave blank to disable).
• Two visibility switches: showAllLevels (on-chart clutter control) and showExtendedLines (project to next day).
• Three colour pickers for fast palette changes. - Practical ways to trade it
• Momentum breakout – wait for a candle close beyond ±1 × range, then trail partials at 1.618 / 2.618.
• Fade the extremes – look for exhaustion signals at 3.618 / 4.618; stop outside the furthest band.
• Reversion ladder – when price drops back inside the range, scale in/out at the grey Fib rungs.
• Pair with volume or oscillator divergence to filter false prints. - Best-practice tips – Works on any intraday symbol but the structure is most reliable on liquid equities, index futures and majors. For very fast charts (<1 min) tighten the session (e.g., 09 : 30–09 : 35) to avoid level congestion.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.