OPEN-SOURCE SCRIPT
BBW + Squeeze

The BBW Squeeze indicator, explained
The idea in one sentence: Markets switch between quiet phases and loud phases. This indicator flags when a market is unusually quiet compared to its own last six months, because a big move often follows a quiet stretch.
How it measures “quiet”
It uses Bollinger Bands. Those are two lines drawn around the price, two standard deviations above and below the 20-bar average. When price swings wildly, the bands spread apart. When price drifts sideways, they pull together.
The indicator doesn’t draw the bands themselves. It plots their width as a percentage of price. That’s the BandWidth (BBW), the light grey line. It’s the same formula as TradingView’s built-in BBW.
What counts as a “squeeze”
John Bollinger’s classic rule: a squeeze happens when BandWidth hits its lowest level in about six months. So the indicator:
Tracks the lowest BandWidth of the last 182 calendar days (the red step line).
Shades the background pink when the current BandWidth is at that low or within 5% above it. The 5% is relative: if the low is 4.0, anything up to 4.2 counts.
Set the tolerance to 0 and you get Bollinger’s rule exactly, with only brand-new lows counting.
Why “calendar days” matters
Most versions count bars, for example “the last 125 bars”. That breaks quickly. 125 daily bars is six months for stocks (5 trading days a week) but only four months for crypto (7 days a week). On a 4-hour chart it’s just three weeks. This version measures real time instead, so the “six-month low” means six months on any chart, whatever the market or timeframe.
Safety rails built in
No fake lows at the start of the chart: the red line and the shading only appear once there are a full six months of data. Otherwise the “lowest in six months” would really be “lowest in the few weeks we have”.
Disabled on weekly and monthly charts: six months is only about 26 weekly bars, or 6 monthly ones. The lowest of six values isn’t meaningful.
Step line on purpose: when an old low drops out of the window, the red line jumps up. That’s bookkeeping, not something the market did.
How to read it
Pink background = volatility is compressed, a “coiled spring”.
It does not tell you the direction. A squeeze can end with a breakout up or a breakdown down. You need price action or another tool to tell which.
The current, unfinished bar can change until it closes, so a squeeze can flicker in and out during that bar.
It’s a visual tool only. There are no alerts and no buy or sell signals.
Settings
BB length (20)
Standard deviations (2): only changes the height of the lines, not when a squeeze is detected
Lookback (182 days)
Tolerance (5%)
The three colours
The idea in one sentence: Markets switch between quiet phases and loud phases. This indicator flags when a market is unusually quiet compared to its own last six months, because a big move often follows a quiet stretch.
How it measures “quiet”
It uses Bollinger Bands. Those are two lines drawn around the price, two standard deviations above and below the 20-bar average. When price swings wildly, the bands spread apart. When price drifts sideways, they pull together.
The indicator doesn’t draw the bands themselves. It plots their width as a percentage of price. That’s the BandWidth (BBW), the light grey line. It’s the same formula as TradingView’s built-in BBW.
What counts as a “squeeze”
John Bollinger’s classic rule: a squeeze happens when BandWidth hits its lowest level in about six months. So the indicator:
Tracks the lowest BandWidth of the last 182 calendar days (the red step line).
Shades the background pink when the current BandWidth is at that low or within 5% above it. The 5% is relative: if the low is 4.0, anything up to 4.2 counts.
Set the tolerance to 0 and you get Bollinger’s rule exactly, with only brand-new lows counting.
Why “calendar days” matters
Most versions count bars, for example “the last 125 bars”. That breaks quickly. 125 daily bars is six months for stocks (5 trading days a week) but only four months for crypto (7 days a week). On a 4-hour chart it’s just three weeks. This version measures real time instead, so the “six-month low” means six months on any chart, whatever the market or timeframe.
Safety rails built in
No fake lows at the start of the chart: the red line and the shading only appear once there are a full six months of data. Otherwise the “lowest in six months” would really be “lowest in the few weeks we have”.
Disabled on weekly and monthly charts: six months is only about 26 weekly bars, or 6 monthly ones. The lowest of six values isn’t meaningful.
Step line on purpose: when an old low drops out of the window, the red line jumps up. That’s bookkeeping, not something the market did.
How to read it
Pink background = volatility is compressed, a “coiled spring”.
It does not tell you the direction. A squeeze can end with a breakout up or a breakdown down. You need price action or another tool to tell which.
The current, unfinished bar can change until it closes, so a squeeze can flicker in and out during that bar.
It’s a visual tool only. There are no alerts and no buy or sell signals.
Settings
BB length (20)
Standard deviations (2): only changes the height of the lines, not when a squeeze is detected
Lookback (182 days)
Tolerance (5%)
The three colours
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。