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.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.