OPEN-SOURCE SCRIPT
BB Volatility Squeeze Momentum

BB Volatility Squeeze / Expansion
This indicator highlights periods when Bollinger Bands are tight relative to price (a volatility squeeze) versus wider expansion phases. Squeeze conditions can be based on Keltner Channels, a percentile of BB width, or both.
What it shows on the chart
Dot vertical position is controlled as a percentage of the bar range below the low.
Squeeze logic (summary)
Keltner-based: Squeeze when the Bollinger envelope sits inside the Keltner envelope (BB lower above KC lower and BB upper below KC upper).
Percentile-based: Computes BB width as (upper - lower) / basis. Squeeze when the percent rank of that width over the lookback is below your threshold (e.g. unusually narrow vs. recent history).
Squeeze method input chooses Keltner only, percentile only, or either (fires if either condition is true). The active squeeze used for band coloring follows that choice; the dots always show both methods for comparison.
Multi-timeframe (MTF) table
A table in the top-right shows four user-selected timeframes. For each TF it reports whether Keltner and percentile squeezes are on (SQZ) or off (—), with red/green cell backgrounds. Calculations use request.security() with no lookahead.
Inputs (by group)
License
This source code is subject to the terms of the Mozilla Public License 2.0.
This indicator highlights periods when Bollinger Bands are tight relative to price (a volatility squeeze) versus wider expansion phases. Squeeze conditions can be based on Keltner Channels, a percentile of BB width, or both.
What it shows on the chart
- Bollinger Bands (upper, lower, SMA basis) drawn on price. Band and fill colors switch with squeeze state: cool tones (blue) when a squeeze is active, warm tones (orange) when it is not.
- Small dots under each bar summarize how each underlying squeeze method reads that bar:
- Green: neither Keltner nor percentile squeeze
- Red: Keltner squeeze only
- Orange: percentile squeeze only
- Yellow: both methods agree (squeeze on both)
Dot vertical position is controlled as a percentage of the bar range below the low.
Squeeze logic (summary)
Keltner-based: Squeeze when the Bollinger envelope sits inside the Keltner envelope (BB lower above KC lower and BB upper below KC upper).
Percentile-based: Computes BB width as (upper - lower) / basis. Squeeze when the percent rank of that width over the lookback is below your threshold (e.g. unusually narrow vs. recent history).
Squeeze method input chooses Keltner only, percentile only, or either (fires if either condition is true). The active squeeze used for band coloring follows that choice; the dots always show both methods for comparison.
Multi-timeframe (MTF) table
A table in the top-right shows four user-selected timeframes. For each TF it reports whether Keltner and percentile squeezes are on (SQZ) or off (—), with red/green cell backgrounds. Calculations use request.security() with no lookahead.
Inputs (by group)
- Bollinger Bands: length, standard-deviation multiplier.
- Keltner Channels: length, ATR multiplier.
- Percentile method: lookback bars for the percent rank, squeeze threshold (percentile).
- Squeeze method: Keltner / percentile / both.
- MTF table: four timeframe strings (defaults: 15m, 1h, 4h, daily).
- Visuals: squeeze dot offset below the bar (% of range).
License
This source code is subject to the terms of the Mozilla Public License 2.0.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.