OPEN-SOURCE SCRIPT
Structural Range Oscillator

█ OVERVIEW
Structural Range Oscillator is a structure-based oscillator that operates within the current market range, dynamically adapting to price extremes or relying on confirmed swing points (pivots).
The indicator measures the position of price within the current market structure, showing whether price is closer to the upper boundary, lower boundary, or equilibrium.
This allows you to analyze:
* structural context of price
* market phases (balance vs expansion)
* transitions between extremes
█ CONCEPTS
Structural Range
The indicator defines a working range using two modes:
Trailing Range (dynamic)
The range updates continuously, but asymmetrically:
* one side of the range (in the direction of price expansion) updates immediately with new highs/lows
* the opposite side updates only after a confirmed pivot forms
This means:
* the range expands quickly in the direction of the move
* but contracts or resets only after structural confirmation
Result:
* fast adaptation to trend
* but in strong trends it may generate more false signals (range keeps shifting with price)
Pivot Range (static)
The range is based entirely on confirmed pivots:
* pivot high/low is formed only after a defined number of candles on both sides (Pivot Length)
* both range boundaries update only after confirmation
This results in:
* delayed updates
* higher structural reliability
* reduced noise and fewer false signals
In practice:
* trailing mode = faster, reactive
* pivot mode = slower, but structurally cleaner
Oscillator Logic
The oscillator calculates price position within the range:
* 0 → price at range low
* 50 → midpoint (equilibrium)
* 100 → price at range high
This helps identify:
* stretched conditions
* relative positioning within structure
Midline (50) – Equilibrium
The 50 level acts as:
* directional bias divider (bullish / bearish)
* dynamic equilibrium level
* short-term directional filter
Persistent Mid Trend
The midpoint of the range (mid) has its own directional behavior:
* rising → structural uptrend
* falling → structural downtrend
This provides an additional layer of trend context independent of the oscillator.
Additionally, an optional feature allows:
* candle coloring based on mid trend direction
which makes trend filtering visually intuitive.
Overbought / Oversold (OB / OS)
OB / OS levels:
* exist within the 0–100 range
* are NOT the range boundaries themselves
They can be adjusted depending on your strategy:
* tighter levels → more signals
* wider levels → more selective signals
Interpretation depends on mode:
* trailing mode → more frequent signals in trends (some may be false due to shifting range)
* pivot mode → fewer but more structurally confirmed signals
█ FEATURES
The indicator offers flexible configuration:
* range mode (Trailing vs Pivot)
* oscillator smoothing (SMA, EMA, RMA, WMA)
* adjustable OB / OS levels (within 0–100 range)
* dynamic transparency of levels - for consistent solid lines, set equal values (e.g. 10)
* gradient fill (momentum visualization)
* range overlay on chart (high / low / mid)
* candle coloring based on mid trend
* channel gradient (range visualization)
* Fibonacci levels based on current range
* alerts
█ APPLICATIONS
Range Trading
In consolidation:
* range high → resistance
* range low → support
* mid → equilibrium
The oscillator acts as a map of market structure.
Trend Context
Combining:
* oscillator position (0–100)
* midline direction
helps determine:
* whether the market is trending
* or just reacting within a range
Breakout Context
If:
* price holds near extremes
* and the range expands (Trailing Mode)
→ it may indicate volatility expansion and continuation
Fibonacci Levels
Fibonacci levels are dynamically derived from the current range:
* anchored based on the latest directional move (0 at high or low)
* update automatically as range evolves
Applications:
* identifying retracement zones within the range
* potential reaction levels
* added confluence with range boundaries and mid
Especially useful when:
* price returns into the range after an impulse
* looking for structured pullback zones
Confluence & Confirmation
The indicator is most effective when combined with other tools:
* if range boundaries align with key support/resistance → higher probability of reaction
* combine with momentum indicators → oscillator signals can act as early signals, while momentum confirms direction
* use structure + momentum together instead of relying on signals alone
Context interpretation
* oscillator near 50 → market in balance
* oscillator near extremes → tension / possible reversal or continuation
* rising mid → bullish structure
* falling mid → bearish structure
█ NOTES
The indicator measures price position within structure, not traditional momentum.
This means:
* it provides contextual insight rather than standalone signals
* it is best used as a decision-support tool, not a trigger on its own
Structural Range Oscillator is a structure-based oscillator that operates within the current market range, dynamically adapting to price extremes or relying on confirmed swing points (pivots).
The indicator measures the position of price within the current market structure, showing whether price is closer to the upper boundary, lower boundary, or equilibrium.
This allows you to analyze:
* structural context of price
* market phases (balance vs expansion)
* transitions between extremes
█ CONCEPTS
Structural Range
The indicator defines a working range using two modes:
Trailing Range (dynamic)
The range updates continuously, but asymmetrically:
* one side of the range (in the direction of price expansion) updates immediately with new highs/lows
* the opposite side updates only after a confirmed pivot forms
This means:
* the range expands quickly in the direction of the move
* but contracts or resets only after structural confirmation
Result:
* fast adaptation to trend
* but in strong trends it may generate more false signals (range keeps shifting with price)
Pivot Range (static)
The range is based entirely on confirmed pivots:
* pivot high/low is formed only after a defined number of candles on both sides (Pivot Length)
* both range boundaries update only after confirmation
This results in:
* delayed updates
* higher structural reliability
* reduced noise and fewer false signals
In practice:
* trailing mode = faster, reactive
* pivot mode = slower, but structurally cleaner
Oscillator Logic
The oscillator calculates price position within the range:
* 0 → price at range low
* 50 → midpoint (equilibrium)
* 100 → price at range high
This helps identify:
* stretched conditions
* relative positioning within structure
Midline (50) – Equilibrium
The 50 level acts as:
* directional bias divider (bullish / bearish)
* dynamic equilibrium level
* short-term directional filter
Persistent Mid Trend
The midpoint of the range (mid) has its own directional behavior:
* rising → structural uptrend
* falling → structural downtrend
This provides an additional layer of trend context independent of the oscillator.
Additionally, an optional feature allows:
* candle coloring based on mid trend direction
which makes trend filtering visually intuitive.
Overbought / Oversold (OB / OS)
OB / OS levels:
* exist within the 0–100 range
* are NOT the range boundaries themselves
They can be adjusted depending on your strategy:
* tighter levels → more signals
* wider levels → more selective signals
Interpretation depends on mode:
* trailing mode → more frequent signals in trends (some may be false due to shifting range)
* pivot mode → fewer but more structurally confirmed signals
█ FEATURES
The indicator offers flexible configuration:
* range mode (Trailing vs Pivot)
* oscillator smoothing (SMA, EMA, RMA, WMA)
* adjustable OB / OS levels (within 0–100 range)
* dynamic transparency of levels - for consistent solid lines, set equal values (e.g. 10)
* gradient fill (momentum visualization)
* range overlay on chart (high / low / mid)
* candle coloring based on mid trend
* channel gradient (range visualization)
* Fibonacci levels based on current range
* alerts
█ APPLICATIONS
Range Trading
In consolidation:
* range high → resistance
* range low → support
* mid → equilibrium
The oscillator acts as a map of market structure.
Trend Context
Combining:
* oscillator position (0–100)
* midline direction
helps determine:
* whether the market is trending
* or just reacting within a range
Breakout Context
If:
* price holds near extremes
* and the range expands (Trailing Mode)
→ it may indicate volatility expansion and continuation
Fibonacci Levels
Fibonacci levels are dynamically derived from the current range:
* anchored based on the latest directional move (0 at high or low)
* update automatically as range evolves
Applications:
* identifying retracement zones within the range
* potential reaction levels
* added confluence with range boundaries and mid
Especially useful when:
* price returns into the range after an impulse
* looking for structured pullback zones
Confluence & Confirmation
The indicator is most effective when combined with other tools:
* if range boundaries align with key support/resistance → higher probability of reaction
* combine with momentum indicators → oscillator signals can act as early signals, while momentum confirms direction
* use structure + momentum together instead of relying on signals alone
Context interpretation
* oscillator near 50 → market in balance
* oscillator near extremes → tension / possible reversal or continuation
* rising mid → bullish structure
* falling mid → bearish structure
█ NOTES
The indicator measures price position within structure, not traditional momentum.
This means:
* it provides contextual insight rather than standalone signals
* it is best used as a decision-support tool, not a trigger on its own
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.