OPEN-SOURCE SCRIPT
Golden Range Zones | Rainbow Matrix

GENERAL OVERVIEW
Golden Range Zones is a nested prior-range projection tool. At every reset boundary it freezes the just-closed period's high and low as the inner Band lines, then scans backward to find the nearest earlier extremes that price has NOT yet broken — the outer Oscillation lines. The gap between each Band and its Oscillation is filled with a golden Fibonacci zone, giving an immediate map of where price has prior structural precedent above and below the current range.
The goal is to answer one question at a glance: where are the levels that actually matter right now, and how much room is there before price reaches them? Instead of a single prior-day high/low pair, you get a nested structure — the recent range bracketed by the closest unbroken historic extremes — with the space between them measured in Fibonacci proportion. Every line is derived from real completed-period extremes, not approximated from the current bar.
The indicator works on crypto and futures (24h session reset) and on stocks (custom trading-hours window with timezone), computes the range from in-session data only, and never repaints its frozen levels.
WHAT IS THE THEORY BEHIND THIS INDICATOR?
Prior high/low levels are among the most watched references in trading — but most tools draw only the single most recent pair (yesterday's high and low) and stop there. That tells you the edges of the last range. It does not tell you what lies beyond those edges: the next level up that price failed to break, or the next level down that has held historically.
Price does not react in a vacuum at the edge of yesterday's range. When it breaks above the recent high, the relevant question becomes "what is the nearest overhead level that has actually rejected price before?" — because that unbroken prior extreme is where the next reaction is statistically more likely. Golden Range Zones formalizes this: it brackets the recent range with the nearest UNBROKEN prior extremes on each side, found by scanning completed periods backward until it locates the first one whose high exceeded (or low undercut) the current range.
The space between the recent edge (Band) and the nearest unbroken extreme (Oscillation) is then divided in Fibonacci proportion — the zone where price travels between "left the recent range" and "reached the next historic wall." Reading that space as a graded golden zone, rather than two bare lines, turns the gap into a structured probability map: the deeper price pushes into the zone, the closer it sits to the level that has rejected it before.
Where no prior breaching extreme exists — price at an all-time high or low, a young asset, a very high reset period — the tool does not go blank. It projects a conservative Oscillation from the Band by 25% of the period range and flags it distinctly, so the structure is always present even at historic extremes.
GOLDEN RANGE ZONES FEATURES
The indicator includes these main components:
◇ Nested Prior-Range Engine (Band + backward-scan Oscillation)
◇ Golden Fibonacci Zones (dual-sided, mirrored)
◇ Extreme-Event Fallback Projection
◇ Black Swan Extension (liquidation-sweep zone)
◇ Session / Custom Trading-Hours Anchoring
◇ Zone-Size % Read-out
◇ Multilingual interface (5 languages) and full visual customization
NESTED PRIOR-RANGE ENGINE
🔹 What It Does
Freezes four static horizontal lines at each reset. The Band lines are the just-closed period's high and low (the inner pair). The Oscillation lines are the nearest prior period extremes that lie beyond that range (the outer pair).
🔹 Method
At each reset, the just-closed period's high and low are pushed to a rolling history of completed-period extremes and frozen as the Band lines. The engine then scans that history backward from the most recent period: the first earlier period whose high exceeds the Band high becomes the Oscillation high; the first whose low undercuts the Band low becomes the Oscillation low. The two sides resolve independently and can sit at very different look-back distances — the overhead wall might be four periods back while the floor below is two hundred periods back. Because both sides are bracketed by real extremes that the recent range did not breach, the structure is always ordered: Oscillation high ≥ Band high ≥ Band low ≥ Oscillation low.
🔹 No-Repaint
Every value comes from closed periods. Once frozen at the reset, the lines do not repaint for the duration of the period.
GOLDEN FIBONACCI ZONES
🔹 What It Does
The gap between each Band (inner) and its Oscillation (outer) is filled with a rainbow Fibonacci zone — the area where price travels from the recent range edge toward the nearest unbroken historic level.
🔹 Method
On each side the axis runs from the Band (ratio 0) to the Oscillation (ratio 1.0). The zone is divided into bands whose widths follow a Fibonacci 1:1:2:3:5:8 distribution, so the sub-bands grow as they approach the outer extreme — the area nearest the historic wall is the widest, where reaction is most likely. The palette runs aqua at the inner edge through to red at the outer edge, mirrored on the upper and lower sides. The space between the two Band lines stays clean, keeping the current trading range visually uncluttered.
EXTREME-EVENT FALLBACK
🔹 What It Does
When the backward scan finds no prior period that breached the Band on a side — price at a historic extreme, a young instrument, or a very high reset period — the Oscillation on that side is projected rather than left blank.
🔹 Method
The orphan side's Oscillation is placed at 25% of the period range beyond the Band, and the line is rendered with a distinct purple accent so it reads clearly as a conservative projection, not a historic level. Only the side without a real prior breach uses the fallback; the other side keeps its true extreme. The tool therefore always presents a complete structure, even in uncharted price territory.
BLACK SWAN EXTENSION
🔹 What It Does
An optional zone projected beyond the Oscillation — the area where price often wicks past a level to sweep liquidity before reacting.
🔹 Why It Matters
Levels are rarely respected to the tick. Price frequently overshoots a key extreme, triggering stops and liquidating leveraged positions, then reverses. The Black Swan extension marks that overshoot band explicitly, so an aggressive wick beyond the Oscillation reads as a potential liquidation sweep rather than a clean breakout.
SESSION / CUSTOM TRADING-HOURS ANCHORING
🔹 What It Does
The reset that defines each period can follow the instrument's native session (ideal for 24h crypto and futures) or a custom trading-hours window in a chosen timezone (ideal for stocks).
🔹 Method
In Session mode the period resets on the symbol's session boundary at the chosen reset timeframe (default Daily). In Custom Hours mode you set an open–close window and a timezone; the running high and low then accumulate from in-session bars only, discarding after-hours movement, and the period rolls over at the window open. This makes the Band represent the true regular-session range for stocks, not a figure distorted by thin extended-hours activity.
ZONE-SIZE % READ-OUT
🔹 What It Does
Three dashed vertical markers, drawn a configurable number of candles past the block, each span one zone and report its size as a percentage of current price.
🔹 The Three Zones
◇ Sell zone (green): Oscillation high → Band high — the room above the recent range.
◇ Neutral zone (gray): Band high → Band low — the recent range itself.
◇ Buy zone (red): Band low → Oscillation low — the room below the recent range.
Reading each zone as a % of price lets you size targets and risk against the structural levels directly.
HOW TO USE
This indicator is not a signal generator. It is a structural map: it shows the recent range, the nearest unbroken extremes that bracket it, and the graded space between them.
🔹 Setup
Set the chart timeframe below the reset period (for example a 15m chart with a Daily reset). For 24h markets leave Reset Mode on Session. For stocks, switch to Custom Hours and set the regular-session window and timezone. If the chart timeframe is at or above the reset period, the projection hides and a guard note appears.
🔹 Reading the Structure
◇ The two Band lines are the just-closed period's range — the immediate edges.
◇ The two Oscillation lines are the nearest prior levels the range has not broken — the next structural walls.
◇ The golden zone between each Band and Oscillation is where price has prior reaction precedent; the Fibonacci-weighted bands widen toward the outer wall.
🔹 Tactical Reading
◇ Price holding inside the Bands — trading within the recent range; no structural test yet.
◇ Price entering a golden zone — travelling toward the nearest unbroken extreme; the deeper it pushes, the closer the historic level.
◇ Price wicking into the Black Swan extension — possible liquidity sweep beyond the level; watch for rejection.
◇ A purple-accented Oscillation — no real prior breach on that side; the level is a conservative projection, treat with lower confidence.
INPUTS EXPLAINED
🔹 System Language
Display language for the panel and labels. Options: English (default), Português, Español, Русский, 中文 (Chinese).
🔹 Reset Period / Reset Mode
The period boundary that defines each range. Session (auto) for 24h markets; Custom Hours (with trading window + timezone) for stocks.
🔹 Lines
Visibility and width for the Band and Oscillation strokes.
🔹 Rainbow Style
Golden-zone visibility and transparency.
🔹 Black Swan / Aqua
The outer liquidation-sweep extension and the inner breathing-room line.
🔹 Extreme Event
Enables the 25%-range fallback projection when no prior breach exists.
🔹 Zone % Lines
The three zone-size verticals and their candle offset from the block.
🔹 Info Panel
Visibility, position, and font size.
IMPORTANT NOTES
Golden Range Zones works on any chart timeframe below the reset period. It is built for instruments with reliable price data across many periods, since the backward scan may look back far to find an unbroken extreme — on very short history the fallback projection covers the gap. In Custom Hours mode the range reflects in-session bars only.
The frozen levels do not repaint within a period; they recompute at the next reset, like an anchored tool. The Fibonacci 1:1:2:3:5:8 zone distribution is part of the canonical Rainbow Matrix design grammar, shared across the portfolio for consistent readability.
Pine Script v6. Open-source under Mozilla Public License 2.0.
UNIQUENESS
Golden Range Zones is unique in how it brackets the recent range. Most prior-range tools draw a single high/low pair; this one finds the nearest UNBROKEN prior extremes on each side via a backward scan through completed-period history, producing a nested structure rather than two bare lines. The space between the recent edge and the nearest unbroken extreme is then divided in Fibonacci 1:1:2:3:5:8 proportion, so the graded zone widens toward the historic wall where reaction is most likely — turning the gap into a structured probability map rather than empty space between two lines. An extreme-event fallback keeps the structure intact at all-time highs and lows by projecting a conservative level instead of going blank, and a Black Swan extension models the liquidation-sweep overshoot beyond each extreme. Session or custom trading-hours anchoring lets the same engine serve 24h crypto and regular-session stocks correctly, computing the range from in-session bars only. The combination of backward-scan nested ranges, Fibonacci-weighted golden zones, conservative fallback projection, and session-aware anchoring produces a structural read of prior-range context that single-pair high/low tools cannot provide.
Golden Range Zones is a nested prior-range projection tool. At every reset boundary it freezes the just-closed period's high and low as the inner Band lines, then scans backward to find the nearest earlier extremes that price has NOT yet broken — the outer Oscillation lines. The gap between each Band and its Oscillation is filled with a golden Fibonacci zone, giving an immediate map of where price has prior structural precedent above and below the current range.
The goal is to answer one question at a glance: where are the levels that actually matter right now, and how much room is there before price reaches them? Instead of a single prior-day high/low pair, you get a nested structure — the recent range bracketed by the closest unbroken historic extremes — with the space between them measured in Fibonacci proportion. Every line is derived from real completed-period extremes, not approximated from the current bar.
The indicator works on crypto and futures (24h session reset) and on stocks (custom trading-hours window with timezone), computes the range from in-session data only, and never repaints its frozen levels.
WHAT IS THE THEORY BEHIND THIS INDICATOR?
Prior high/low levels are among the most watched references in trading — but most tools draw only the single most recent pair (yesterday's high and low) and stop there. That tells you the edges of the last range. It does not tell you what lies beyond those edges: the next level up that price failed to break, or the next level down that has held historically.
Price does not react in a vacuum at the edge of yesterday's range. When it breaks above the recent high, the relevant question becomes "what is the nearest overhead level that has actually rejected price before?" — because that unbroken prior extreme is where the next reaction is statistically more likely. Golden Range Zones formalizes this: it brackets the recent range with the nearest UNBROKEN prior extremes on each side, found by scanning completed periods backward until it locates the first one whose high exceeded (or low undercut) the current range.
The space between the recent edge (Band) and the nearest unbroken extreme (Oscillation) is then divided in Fibonacci proportion — the zone where price travels between "left the recent range" and "reached the next historic wall." Reading that space as a graded golden zone, rather than two bare lines, turns the gap into a structured probability map: the deeper price pushes into the zone, the closer it sits to the level that has rejected it before.
Where no prior breaching extreme exists — price at an all-time high or low, a young asset, a very high reset period — the tool does not go blank. It projects a conservative Oscillation from the Band by 25% of the period range and flags it distinctly, so the structure is always present even at historic extremes.
GOLDEN RANGE ZONES FEATURES
The indicator includes these main components:
◇ Nested Prior-Range Engine (Band + backward-scan Oscillation)
◇ Golden Fibonacci Zones (dual-sided, mirrored)
◇ Extreme-Event Fallback Projection
◇ Black Swan Extension (liquidation-sweep zone)
◇ Session / Custom Trading-Hours Anchoring
◇ Zone-Size % Read-out
◇ Multilingual interface (5 languages) and full visual customization
NESTED PRIOR-RANGE ENGINE
🔹 What It Does
Freezes four static horizontal lines at each reset. The Band lines are the just-closed period's high and low (the inner pair). The Oscillation lines are the nearest prior period extremes that lie beyond that range (the outer pair).
🔹 Method
At each reset, the just-closed period's high and low are pushed to a rolling history of completed-period extremes and frozen as the Band lines. The engine then scans that history backward from the most recent period: the first earlier period whose high exceeds the Band high becomes the Oscillation high; the first whose low undercuts the Band low becomes the Oscillation low. The two sides resolve independently and can sit at very different look-back distances — the overhead wall might be four periods back while the floor below is two hundred periods back. Because both sides are bracketed by real extremes that the recent range did not breach, the structure is always ordered: Oscillation high ≥ Band high ≥ Band low ≥ Oscillation low.
🔹 No-Repaint
Every value comes from closed periods. Once frozen at the reset, the lines do not repaint for the duration of the period.
GOLDEN FIBONACCI ZONES
🔹 What It Does
The gap between each Band (inner) and its Oscillation (outer) is filled with a rainbow Fibonacci zone — the area where price travels from the recent range edge toward the nearest unbroken historic level.
🔹 Method
On each side the axis runs from the Band (ratio 0) to the Oscillation (ratio 1.0). The zone is divided into bands whose widths follow a Fibonacci 1:1:2:3:5:8 distribution, so the sub-bands grow as they approach the outer extreme — the area nearest the historic wall is the widest, where reaction is most likely. The palette runs aqua at the inner edge through to red at the outer edge, mirrored on the upper and lower sides. The space between the two Band lines stays clean, keeping the current trading range visually uncluttered.
EXTREME-EVENT FALLBACK
🔹 What It Does
When the backward scan finds no prior period that breached the Band on a side — price at a historic extreme, a young instrument, or a very high reset period — the Oscillation on that side is projected rather than left blank.
🔹 Method
The orphan side's Oscillation is placed at 25% of the period range beyond the Band, and the line is rendered with a distinct purple accent so it reads clearly as a conservative projection, not a historic level. Only the side without a real prior breach uses the fallback; the other side keeps its true extreme. The tool therefore always presents a complete structure, even in uncharted price territory.
BLACK SWAN EXTENSION
🔹 What It Does
An optional zone projected beyond the Oscillation — the area where price often wicks past a level to sweep liquidity before reacting.
🔹 Why It Matters
Levels are rarely respected to the tick. Price frequently overshoots a key extreme, triggering stops and liquidating leveraged positions, then reverses. The Black Swan extension marks that overshoot band explicitly, so an aggressive wick beyond the Oscillation reads as a potential liquidation sweep rather than a clean breakout.
SESSION / CUSTOM TRADING-HOURS ANCHORING
🔹 What It Does
The reset that defines each period can follow the instrument's native session (ideal for 24h crypto and futures) or a custom trading-hours window in a chosen timezone (ideal for stocks).
🔹 Method
In Session mode the period resets on the symbol's session boundary at the chosen reset timeframe (default Daily). In Custom Hours mode you set an open–close window and a timezone; the running high and low then accumulate from in-session bars only, discarding after-hours movement, and the period rolls over at the window open. This makes the Band represent the true regular-session range for stocks, not a figure distorted by thin extended-hours activity.
ZONE-SIZE % READ-OUT
🔹 What It Does
Three dashed vertical markers, drawn a configurable number of candles past the block, each span one zone and report its size as a percentage of current price.
🔹 The Three Zones
◇ Sell zone (green): Oscillation high → Band high — the room above the recent range.
◇ Neutral zone (gray): Band high → Band low — the recent range itself.
◇ Buy zone (red): Band low → Oscillation low — the room below the recent range.
Reading each zone as a % of price lets you size targets and risk against the structural levels directly.
HOW TO USE
This indicator is not a signal generator. It is a structural map: it shows the recent range, the nearest unbroken extremes that bracket it, and the graded space between them.
🔹 Setup
Set the chart timeframe below the reset period (for example a 15m chart with a Daily reset). For 24h markets leave Reset Mode on Session. For stocks, switch to Custom Hours and set the regular-session window and timezone. If the chart timeframe is at or above the reset period, the projection hides and a guard note appears.
🔹 Reading the Structure
◇ The two Band lines are the just-closed period's range — the immediate edges.
◇ The two Oscillation lines are the nearest prior levels the range has not broken — the next structural walls.
◇ The golden zone between each Band and Oscillation is where price has prior reaction precedent; the Fibonacci-weighted bands widen toward the outer wall.
🔹 Tactical Reading
◇ Price holding inside the Bands — trading within the recent range; no structural test yet.
◇ Price entering a golden zone — travelling toward the nearest unbroken extreme; the deeper it pushes, the closer the historic level.
◇ Price wicking into the Black Swan extension — possible liquidity sweep beyond the level; watch for rejection.
◇ A purple-accented Oscillation — no real prior breach on that side; the level is a conservative projection, treat with lower confidence.
INPUTS EXPLAINED
🔹 System Language
Display language for the panel and labels. Options: English (default), Português, Español, Русский, 中文 (Chinese).
🔹 Reset Period / Reset Mode
The period boundary that defines each range. Session (auto) for 24h markets; Custom Hours (with trading window + timezone) for stocks.
🔹 Lines
Visibility and width for the Band and Oscillation strokes.
🔹 Rainbow Style
Golden-zone visibility and transparency.
🔹 Black Swan / Aqua
The outer liquidation-sweep extension and the inner breathing-room line.
🔹 Extreme Event
Enables the 25%-range fallback projection when no prior breach exists.
🔹 Zone % Lines
The three zone-size verticals and their candle offset from the block.
🔹 Info Panel
Visibility, position, and font size.
IMPORTANT NOTES
Golden Range Zones works on any chart timeframe below the reset period. It is built for instruments with reliable price data across many periods, since the backward scan may look back far to find an unbroken extreme — on very short history the fallback projection covers the gap. In Custom Hours mode the range reflects in-session bars only.
The frozen levels do not repaint within a period; they recompute at the next reset, like an anchored tool. The Fibonacci 1:1:2:3:5:8 zone distribution is part of the canonical Rainbow Matrix design grammar, shared across the portfolio for consistent readability.
Pine Script v6. Open-source under Mozilla Public License 2.0.
UNIQUENESS
Golden Range Zones is unique in how it brackets the recent range. Most prior-range tools draw a single high/low pair; this one finds the nearest UNBROKEN prior extremes on each side via a backward scan through completed-period history, producing a nested structure rather than two bare lines. The space between the recent edge and the nearest unbroken extreme is then divided in Fibonacci 1:1:2:3:5:8 proportion, so the graded zone widens toward the historic wall where reaction is most likely — turning the gap into a structured probability map rather than empty space between two lines. An extreme-event fallback keeps the structure intact at all-time highs and lows by projecting a conservative level instead of going blank, and a Black Swan extension models the liquidation-sweep overshoot beyond each extreme. Session or custom trading-hours anchoring lets the same engine serve 24h crypto and regular-session stocks correctly, computing the range from in-session bars only. The combination of backward-scan nested ranges, Fibonacci-weighted golden zones, conservative fallback projection, and session-aware anchoring produces a structural read of prior-range context that single-pair high/low tools cannot provide.
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.
Rainbow Matrix AI - Multi-timeframe institutional analysis tools.
rainbowmatrix.ai
rainbowmatrix.ai
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.
Rainbow Matrix AI - Multi-timeframe institutional analysis tools.
rainbowmatrix.ai
rainbowmatrix.ai
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.