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 автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.