OPEN-SOURCE SCRIPT

Multi-Band Comparison (Uptrend)

Multi-Band Comparison

Overview:
The Multi-Band Comparison indicator is engineered to reveal critical levels of support and resistance in strong uptrends. In a healthy upward market, the price action will adhere closely to the 95th percentile line (the Upper Quantile Band), effectively “riding” it. This indicator combines a modified Bollinger Band (set at one standard deviation), quantile analysis (95% and 5% levels), and power‑law math to display a dynamic picture of market structure—highlighting a “golden channel” and robust support areas.

Key Components & Calculations:

The Golden Channel: Upper Bollinger Band & Upper Std Dev Band of the Upper Quantile
Upper Bollinger Band:
Calculation:
boll_upper=SMA(close,length)+(boll_mult×stdev)
boll_upper=SMA(close,length)+(boll_mult×stdev) Here, the 20-period SMA is used along with one standard deviation of the close, where the multiplier (boll_mult) is 1.0.
Role in an Uptrend:
In a healthy uptrend, price rides near the 95th percentile line. When price crosses above this Upper Bollinger Band, it confirms strong bullish momentum.
Upper Std Dev Band of the Upper Quantile (95th Percentile) Band:
Calculation:
quant_upper_std_up=quant_upper+stdev
quant_upper_std_up=quant_upper+stdev The Upper Quantile Band, quant_upperquant_upper, is calculated as the 95th percentile of recent price data. Adding one standard deviation creates an extension that accounts for normal volatility around this extreme level.
The Golden Channel:
When the price crosses above the Upper Bollinger Band, the Upper Std Dev Band of the Upper Quantile immediately shifts to gold (yellow) and remains gold until price falls below the Bollinger level. Together, these two lines form the “golden channel”—a visual hallmark of a healthy uptrend where the price reliably hugs the 95th percentile level.

Upper Power‑Law Band
Calculation:
The Upper Power‑Law Band is derived in two steps:
Determine the Extreme Return Factor:
power_upper=Percentile(returns,95%)
power_upper=Percentile(returns,95%) where returns are computed as:
returns=closeclose[1]−1.
returns=close[1]close​−1.
Scale the Current Price:
power_upper_band=close×(1+power_upper)
power_upper_band=close×(1+power_upper)
Rationale and Correlation:
By focusing on the upper 5% of returns (reflecting “fat tails”), the Upper Power‑Law Band captures extreme but statistically expected movements. In an uptrend, its value often converges with the Upper Std Dev Band of the Upper Quantile because both measures reflect heightened volatility and extreme price levels. When the Upper Power‑Law Band exceeds the Upper Std Dev Band, it can signal a temporary overextension.

Upper Quantile Band (95% Percentile)
Calculation:
quant_upper=Percentile(price,95%)
quant_upper=Percentile(price,95%) This level represents where 95% of past price data falls below, and in a robust uptrend the price action practically rides this line.
Color Logic:
Its color shifts from a neutral (blackish) tone to a vibrant, bullish hue when the Upper Power‑Law Band crosses above it—signaling extra strength in the trend.

Lower Quantile and Its Support
Lower Quantile Band (5% Percentile):
Calculation:
quant_lower=Percentile(price,5%)
quant_lower=Percentile(price,5%)
Behavior:
In a healthy uptrend, price remains well above the Lower Quantile Band. It turns red only when price touches or crosses it, serving as a warning signal. Under normal conditions it remains bright green, indicating the market is not nearing these extreme lows.
Lower Std Dev Band of the Lower Quantile:
This line is calculated by subtracting one standard deviation from quant_lowerquant_lower and typically serves as absolute support in nearly all conditions (except during gap or near-gap moves). Its consistent role as support provides traders with a robust level to monitor.

How to Use the Indicator:

Golden Channel and Trend Confirmation:
As price rides the Upper Quantile (95th percentile) perfectly in a healthy uptrend, the Upper Bollinger Band (1 stdev above SMA) and the Upper Std Dev Band of the Upper Quantile form a “golden channel” once price crosses above the Bollinger level. When this occurs, the Upper Std Dev Band remains gold until price dips back below the Bollinger Band. This visual cue reinforces trend strength.

Power‑Law Insights:
The Upper Power‑Law Band, which is based on extreme (95th percentile) returns, tends to align with the Upper Std Dev Band. This convergence reinforces that extreme, yet statistically expected, price moves are occurring—indicating that even though the price rides the 95th percentile, it can only stretch so far before a correction or consolidation.

Support Indicators:
Primary and Secondary Support in Uptrends:
The Upper Bollinger Band and the Lower Std Dev Band of the Upper Quantile act as support zones for minor retracements in the uptrend.
Absolute Support:
The Lower Std Dev Band of the Lower Quantile serves as an almost invariable support area under most market conditions.

Conclusion:
The Multi-Band Comparison indicator unifies advanced statistical techniques to offer a clear view of uptrend structure. In a healthy bull market, price action rides the 95th percentile line with precision, and when the Upper Bollinger Band is breached, the corresponding Upper Std Dev Band turns gold to form a “golden channel.” This, combined with the Power‑Law analysis that captures extreme moves, and the robust lower support levels, provides traders with powerful, multi-dimensional insights for managing entries, exits, and risk.

Disclaimer:
Trading involves risk. This indicator is for educational purposes only and does not constitute financial advice. Always perform your own analysis before making trading decisions.
Bands and ChannelsBollinger Bands (BB)Support and Resistance

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité