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!
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。