OPEN-SOURCE SCRIPT
Bollinger BandWidth (Session-Adjusted)

Description
This indicator is a session-adjusted version of Bollinger BandWidth (BBW), specifically designed for instruments with limited trading hours, such as European stock indices (e.g., FTSE MIB, DAX, CAC, which trades from 09:00 to 17:30 CET — 8.5 hours) or individual stocks.
Standard Bollinger BandWidth on intraday charts can be distorted because calculations include non-trading periods (flat prices overnight), leading to inaccurate volatility readings.This script dynamically adjusts the Bollinger Bands calculation to approximate daily periods based on the actual trading session length, ensuring the BBW reflects true market volatility during active hours.
Key Features
Session-Adjusted Bollinger Bands:
The lookback period (default 20 days) is converted into an equivalent number of intraday candles based on your chart's timeframe and the session duration. This makes the indicator suitable for intraday timeframes (e.g., 5min, 15min, 1H) on limited-session assets.
Bollinger BandWidth (BBW) as Percentage:
Plots (Upper Band - Lower Band) / Middle Band * 100, a relative measure of volatility (higher values = wider bands = higher volatility).
Dynamic Expansion and Contraction Levels:
Red line: Highest BBW over the selected expansion lookback period (default 25 days) — highlights peak volatility levels.
Green line: Lowest BBW over the selected contraction lookback period (default 25 days) — highlights extreme squeezes (low volatility).
Fully customizable inputs for session hours, BB parameters, and dynamic level periods.
How It Works
Session Adjustment: Input session duration (default 8.5 hours).
The script calculates approximate candles per trading day for your current chart timeframe.
Bollinger Bands are computed using length * candlesPerDay bars, simulating a true multi-day calculation within intraday data.
BBW Calculation:
Basis: Simple Moving Average (SMA).
Deviation: Multiplier × Standard Deviation.
BBW = (2 × Deviation / Basis) × 100.
Dynamic Lines:
Expansion line uses the same session-adjusted period for highest BBW.
Contraction line uses the lowest BBW.
Usage and Trading Ideas
Bollinger BandWidth is a powerful volatility indicator popularized by John Bollinger. Low BBW values indicate band contraction ("Squeeze") — periods of low volatility often followed by strong breakouts. High BBW values indicate expansion — trending or volatile phases that may exhaust and lead to consolidation.
Squeeze Setup:
Watch for BBW dropping toward or below the dynamic low (green) line. This signals potential impending volatility expansion and breakout opportunities.
Expansion Confirmation:
BBW rising above the dynamic high (red) line suggests strong volatility — useful for trend-following or avoiding counter-trend trades.
Combine with price action (e.g., break of support/resistance), volume, or momentum indicators (RSI, MACD) for directional bias.
Ideal for intraday or swing trading on European indices, stocks, or other limited-session instruments where standard BBW would be misleading.
This adjustment makes the indicator more accurate on lower timeframes compared to built-in versions, providing cleaner volatility signals aligned with real trading sessions.
Enjoy the script — feedback welcome!
This indicator is a session-adjusted version of Bollinger BandWidth (BBW), specifically designed for instruments with limited trading hours, such as European stock indices (e.g., FTSE MIB, DAX, CAC, which trades from 09:00 to 17:30 CET — 8.5 hours) or individual stocks.
Standard Bollinger BandWidth on intraday charts can be distorted because calculations include non-trading periods (flat prices overnight), leading to inaccurate volatility readings.This script dynamically adjusts the Bollinger Bands calculation to approximate daily periods based on the actual trading session length, ensuring the BBW reflects true market volatility during active hours.
Key Features
Session-Adjusted Bollinger Bands:
The lookback period (default 20 days) is converted into an equivalent number of intraday candles based on your chart's timeframe and the session duration. This makes the indicator suitable for intraday timeframes (e.g., 5min, 15min, 1H) on limited-session assets.
Bollinger BandWidth (BBW) as Percentage:
Plots (Upper Band - Lower Band) / Middle Band * 100, a relative measure of volatility (higher values = wider bands = higher volatility).
Dynamic Expansion and Contraction Levels:
Red line: Highest BBW over the selected expansion lookback period (default 25 days) — highlights peak volatility levels.
Green line: Lowest BBW over the selected contraction lookback period (default 25 days) — highlights extreme squeezes (low volatility).
Fully customizable inputs for session hours, BB parameters, and dynamic level periods.
How It Works
Session Adjustment: Input session duration (default 8.5 hours).
The script calculates approximate candles per trading day for your current chart timeframe.
Bollinger Bands are computed using length * candlesPerDay bars, simulating a true multi-day calculation within intraday data.
BBW Calculation:
Basis: Simple Moving Average (SMA).
Deviation: Multiplier × Standard Deviation.
BBW = (2 × Deviation / Basis) × 100.
Dynamic Lines:
Expansion line uses the same session-adjusted period for highest BBW.
Contraction line uses the lowest BBW.
Usage and Trading Ideas
Bollinger BandWidth is a powerful volatility indicator popularized by John Bollinger. Low BBW values indicate band contraction ("Squeeze") — periods of low volatility often followed by strong breakouts. High BBW values indicate expansion — trending or volatile phases that may exhaust and lead to consolidation.
Squeeze Setup:
Watch for BBW dropping toward or below the dynamic low (green) line. This signals potential impending volatility expansion and breakout opportunities.
Expansion Confirmation:
BBW rising above the dynamic high (red) line suggests strong volatility — useful for trend-following or avoiding counter-trend trades.
Combine with price action (e.g., break of support/resistance), volume, or momentum indicators (RSI, MACD) for directional bias.
Ideal for intraday or swing trading on European indices, stocks, or other limited-session instruments where standard BBW would be misleading.
This adjustment makes the indicator more accurate on lower timeframes compared to built-in versions, providing cleaner volatility signals aligned with real trading sessions.
Enjoy the script — feedback welcome!
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.