This TradingView script calculates and visualizes the Normalized Bollinger Band Distance to analyze the relative spread of Bollinger Bands as a percentage of the moving average. It also determines thresholds based on global statistics to highlight unusual market conditions. Here's a detailed description:
Indicator Overview Purpose: The indicator measures the normalized distance between the upper and lower Bollinger Bands relative to the Simple Moving Average (SMA). It helps identify periods of high or low volatility. Visualization: Displays the normalized distance along with dynamic thresholds based on global statistical calculations (mean and standard deviation). Inputs Length (length): Defines the period for the SMA and Bollinger Bands calculation. Default is 200. Standard Deviations (stdDev): Number of standard deviations for the Bollinger Bands. Default is 2. Calculation Bollinger Bands:
Upper Band: SMA + ( Standard Deviation × stdDev ) SMA+(Standard Deviation×stdDev) Lower Band: SMA − ( Standard Deviation × stdDev ) SMA−(Standard Deviation×stdDev) Normalized Distance:
Normalized Distance = Upper Band − Lower Band SMA Normalized Distance= SMA Upper Band−Lower Band
Global Statistics:
Global Mean ( 𝜇 μ): Average of all normalized distances up to the current bar. Global Standard Deviation ( 𝜎 σ): Standard deviation of all normalized distances up to the current bar. High Threshold: 𝜇 + 1.5 × 𝜎 μ+1.5×σ Low Threshold: 𝜇 − 1.5 × 𝜎 μ−1.5×σ Visualization Normalized Distance Plot: The normalized distance is plotted in blue as a percentage for easy interpretation. Threshold Lines: High Threshold: Red line to signal unusually high volatility. Low Threshold: Green line to signal unusually low volatility. Mean Line: White line indicating the average normalized distance. Zero Line: Horizontal white line for reference. Use Case High Threshold Breach: Indicates an unusual increase in Bollinger Band width relative to the SMA, signaling potential high market volatility. Low Threshold Breach: Indicates an unusual narrowing of Bollinger Band width, suggesting low volatility and potential consolidation. Trend Analysis: Observe how the normalized distance evolves over time to anticipate market conditions.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.