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!
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.