Indicators··5 min read

Bollinger Band Squeeze Meter (Bandwidth Percentile)

0 references, link-verified · inline [n] markersEditor of record: Shane CantyStandards review editorial standard · audit log

The Bollinger Band Squeeze Meter ranks the current volatility band width against historical values, expressing it as a percentile. It shows traders where volatility stands relative to recent history: high percentiles indicate wide bands (expansive volatility); low percentiles indicate tight bands (squeeze). This helps identify periods of low volatility that often precede sharp moves, and confirms when volatility is expanding relative to its recent range.

//@version=6
indicator("BB Squeeze Meter (Bandwidth %ile)", shorttitle="BB Squeeze %ile", overlay=false)

// Inputs
bbLength = input.int(20, title="Bollinger Band Period", minval=5)
bbStdDev = input.float(2.0, title="Standard Deviations", minval=0.1, step=0.1)
pctLength = input.int(252, title="Percentile Lookback (bars)", minval=20)
showHistogram = input.bool(true, title="Show as Histogram")

// Calculate Bollinger Bands
basis = ta.sma(close, bbLength)
stdDev = ta.stdev(close, bbLength)
upper = basis + (bbStdDev * stdDev)
lower = basis - (bbStdDev * stdDev)

// Calculate bandwidth as percentage of basis
bandwidth = (upper - lower) / basis

// Calculate percentile rank of current bandwidth vs lookback period
// Count how many bars in lookback period have bandwidth <= current bandwidth
countBelowCurrent = 0
for i = 0 to pctLength - 1
    if bandwidth[i] <= bandwidth[0]
        countBelowCurrent += 1

bandwidthPercentile = (countBelowCurrent / pctLength) * 100

// Plot
plotColor = showHistogram ? (bandwidthPercentile >= 50 ? color.new(color.blue, 60) : color.new(color.orange, 60)) : na
plot(showHistogram ? bandwidthPercentile : na, title="Bandwidth Percentile", style=plot.style_histogram, color=plotColor, linewidth=2)
plot(showHistogram ? na : bandwidthPercentile, title="Bandwidth Percentile Line", color=color.new(color.blue, 0), linewidth=2)

// Reference levels
hline(50, title="Median (50%)", color=color.gray, linestyle=hline.style_dashed, linewidth=1)
hline(20, title="Low Volatility (20%)", color=color.new(color.orange, 40), linestyle=hline.style_dotted, linewidth=1)
hline(80, title="High Volatility (80%)", color=color.new(color.blue, 40), linestyle=hline.style_dotted, linewidth=1)

How the code works

The indicator first calculates standard Bollinger Bands using a configurable period (default 20 bars) and standard deviation multiplier (default 2.0). These bands capture the envelope of price movement over the recent window.

Bandwidth is then computed as the ratio of the band width (upper band minus lower band) divided by the basis (middle line, typically a simple moving average). This normalization makes the metric comparable across assets of different price scales.

The percentile ranking counts how many bars in the lookback period (default 252 bars, roughly one year of trading) have a bandwidth value less than or equal to the current bandwidth. This count is divided by the total lookback length and multiplied by 100 to yield a percentile from 0 to 100. A percentile of 20 means the current bandwidth is tighter than 80% of the historical sample; a percentile of 80 means it is wider than 80% of history.

The plot uses a histogram by default, with orange for below-median volatility and blue for above-median. Horizontal reference lines at 20%, 50%, and 80% help identify squeeze zones and extremes.

Reading it on a chart

A reading near 0-20% indicates a squeeze: the bands are tighter than they have been in recent months. This often precedes volatility expansion and is a classic setup for breakout traders.

A reading near 50% indicates typical volatility; no unusual compression or expansion is occurring.

A reading near 80-100% indicates volatility is at elevated levels relative to recent history. This may signal that a move is already underway or that options premiums are inflated.

Practitioners typically watch for sustained time below 20% followed by a reversal in the percentile metric; this marks the moment the squeeze releases and directional trading may offer better risk-reward.

Limitations

Percentile ranking is backward-looking and depends entirely on the choice of lookback period. A 252-bar lookback (one year) may miss longer-term volatility cycles; a shorter lookback is more reactive but noisier. The indicator reveals only the current position within recent history, not whether a squeeze will lead to an upside or downside breakout; directional clues must come from price action or other indicators.

The indicator does not account for gap risk or overnight volatility outside trading hours. On assets with irregular or sparse data, the percentile calculation may be unreliable.

Bollinger Bands assume prices are normally distributed, which is not true for most financial assets, especially during tail events. The percentile metric may over-state or understate true volatility extremes.

Key definitions

Bollinger Bands: Upper and lower bands placed at a specified number of standard deviations above and below a moving average, used to identify price volatility and overbought/oversold conditions.

Bandwidth: The vertical distance between the upper and lower Bollinger Bands, expressed as a fraction of the basis (middle band) to normalize for price scale.

Percentile rank: The position of a value within a historical sample, expressed as the percentage of observations at or below that value; ranges from 0 (minimum) to 100 (maximum).

Squeeze: A period of low volatility in which Bollinger Bands tighten, often preceding rapid price movement.

Standard deviation: A measure of how far price observations typically scatter from their average; high standard deviation indicates high volatility.

References

  1. Bollinger, J., "Bollinger Bands" (official documentation and educational material). Https://www.bollingerbands.com/
  2. Investopedia, "Bollinger Bands", Investopedia (accessed 2025). Https://www.investopedia.com/terms/b/bollingerbands.asp
  3. TA Lib / Pine Script Documentation, "Standard Deviation and Moving Averages", TradingView Pine Script Reference (2024). Https://www.tradingview.com/pine-script-docs/

Educational research on historical data only. Not investment advice, not a signal, and never a performance promise. Past results do not predict future performance. Every reference is link-verified before publication and every paper is re-audited weekly against the library's editorial standard.

Last reviewed by the PropLedger research pipeline: 2026-10-11. Educational research on historical data, not financial advice.

Educational research on historical data only. Not investment advice, not a signal, and never a performance promise. Past results do not predict future performance. Every reference is link-verified before publication and every paper is re-audited weekly against the library's editorial standard. Found an error? Email support@prop-ledger.org and the paper is corrected or withdrawn.