Technical Analysis · Volatility Indicators

Bollinger Bands Complete Guide
Beyond "Sell at the Upper, Buy at the Lower"

2026-06-03·11 min read·Beginner ~ Intermediate

Bollinger Bands is a volatility indicator invented by John Bollinger in the 1980s, and nearly every trader on the planet has seen it. But 90% of users only know the beginner playbook: "sell when price touches the upper band, buy when it touches the lower band" — and that approach gets repeatedly slapped down in strong trends.

This guide covers the math (why ±2 standard deviations), four real-world applications, the "Squeeze" breakout strategy, the Walk the Bands phenomenon Bollinger himself defined, and complete Pine Script code.

1. The Math Behind Bollinger Bands

Three lines:

text
Middle Band = SMA(close, 20)         // 20-period simple moving average
Std Dev     = stdev(close, 20)       // standard deviation of the last 20 closes
Upper Band  = Middle + 2 × Std Dev
Lower Band  = Middle - 2 × Std Dev

Key concept: standard deviation.

Why ±2 standard deviations?

Statistical principle: if price follows a normal distribution,95.4% of the time it will sit inside ±2σ. In plain English: out of 100 candles, roughly 95 will stay inside the bands and 5 will touch or pierce through.

But real financial assets aren't normally distributed — they have "fat tails": extreme events happen more often than a normal distribution predicts. So in practice, price touches the bands more frequently than 5% of the time. That deviation is the trap Bollinger Bands set for you, and the root cause of the "Walk the Bands" phenomenon we'll get to later.

Parameters: why 20 / 2.0
Bollinger's own recommendation: 20-period SMA + 2.0 standard deviations. This is the standard setting for daily charts. A shorter period (10) with a smaller multiplier (1.5) works for short-term scalping; a longer period (50) with a larger multiplier (2.5) works for longer-term swings. But it's strongly discouraged to tweak too aggressively — Bollinger himself said: "If you do better with 20/2.5, fine; but the 20/2.0 settings have been very robust."

2. Beginner Application: Mean Reversion (Most Common, Most Likely to Blow Up)

The intuition:

  • Price hits the upper band → overextended, short the bounce
  • Price hits the lower band → overextended, buy the bounce
Why this approach fails so often in crypto
During a BTC bull market, price can "walk along the upper band" for 30 consecutive candles, touching the upper band every single one while continuing to rip higher. Following this rule, you get stopped out the whole way up — we saw this in both 2017 and 2020 bull runs.
Bollinger himself called this phenomenon "Walking the Bands" — a signature of trending markets, not a reversal signal.
pine
//@version=5
strategy("BB Mean Reversion (Teaching Version)", overlay=true)

length = input.int(20, "Period")
mult = input.float(2.0, "Std Dev Multiplier")

basis = ta.sma(close, length)
dev = mult * ta.stdev(close, length)
upper = basis + dev
lower = basis - dev

// Price touches lower band → buy
if (ta.crossunder(low, lower))
    strategy.entry("Long", strategy.long)

// Price touches upper band → sell
if (ta.crossover(high, upper))
    strategy.entry("Short", strategy.short)

plot(basis, "Middle", color=color.orange)
plot(upper, "Upper", color=color.red)
plot(lower, "Lower", color=color.green)

3. Intermediate Application: Squeeze Breakout Strategy

This is where Bollinger Bands really shine. When the bands contract (upper and lower draw close together), volatility is dropping, the market is storing energy → the breakout direction often unleashes a big move.

How do you define a Squeeze?

Two common definitions:

A. Bollinger Bands Width (BBW)

text
BBW = (Upper - Lower) / Middle

BBW drops to its lowest value over the past X periods = Squeeze. Bollinger himself uses a 6-month low as the threshold.

B. Bollinger Squeeze (vs Keltner Channel)

When the Bollinger Bands sit entirely inside the Keltner Channel, that's a Squeeze. This is John Carter's version (from his book Mastering the Trade).

pine
//@version=5
strategy("BB Squeeze Breakout", overlay=true)

length = input.int(20, "Period")
mult = input.float(2.0, "BB Multiplier")
keltnerMult = input.float(1.5, "Keltner Multiplier")

basis = ta.sma(close, length)
dev = mult * ta.stdev(close, length)
bbUpper = basis + dev
bbLower = basis - dev

atr = ta.atr(length)
keltnerUpper = basis + keltnerMult * atr
keltnerLower = basis - keltnerMult * atr

// Squeeze condition: BB inside Keltner
squeeze = bbUpper < keltnerUpper and bbLower > keltnerLower

// Squeeze ends + price breaks above upper band → go long
if (not squeeze and squeeze[1] and close > bbUpper)
    strategy.entry("Long", strategy.long)

// Squeeze ends + price breaks below lower band → go short
if (not squeeze and squeeze[1] and close < bbLower)
    strategy.entry("Short", strategy.short)

plot(basis, "Middle", color=color.orange)
plot(bbUpper, "BB Upper", color=color.red)
plot(bbLower, "BB Lower", color=color.green)
bgcolor(squeeze ? color.new(color.purple, 90) : na, title="Squeeze")
Real-world tip: the Squeeze doesn't tell you direction
The Squeeze only says "a big move is coming" — it doesn't tell you up or down. Pair it with: (1) the larger trend direction (SMA 200 / EMA 50), (2) breakout volume, and (3) confirmation from other indicators.

4. Advanced Application: The %B Indicator

Bollinger later added a companion indicator called %Bthat quantifies where price sits inside the bands:

text
%B = (close - Lower) / (Upper - Lower)

%B = 0     → price just touched the lower band
%B = 0.5   → price is at the middle band
%B = 1     → price just touched the upper band
%B > 1     → price broke above the upper band (strong trend)
%B < 0     → price broke below the lower band (strong trend)

With %B you can run:

  • %B divergence: price makes a new high but %B doesn't → trend momentum is fading
  • %B + RSI: %B > 0.95 and RSI > 70 → double-confirmed overbought
  • %B crossing above 0.5: price moves from the lower half to the upper half — often a trend-starting signal

5. Pro Application: BB + RSI + Trend Filter

The combination Bollinger himself recommended most. Full workflow:

  1. Use the SMA 200 to gauge larger trend direction (above SMA 200 = bullish structure)
  2. Price pulls back to the BB middle band (not the lower band) → trend pullback entry
  3. RSI is simultaneously > 50 (bullish momentum still intact)
  4. Enter long
pine
//@version=5
strategy("BB Middle Pullback + Trend Filter", overlay=true)

basis = ta.sma(close, 20)
dev = 2.0 * ta.stdev(close, 20)
upper = basis + dev
lower = basis - dev

sma200 = ta.sma(close, 200)
rsi = ta.rsi(close, 14)

// Bullish structure: price > SMA 200 + RSI > 50
bullishStructure = close > sma200 and rsi > 50

// Pullback to middle: low touches middle band but close reclaims above it
pullback = low <= basis and close > basis

if (bullishStructure and pullback)
    strategy.entry("Long", strategy.long)

// Close below middle + RSI < 50 → exit
if (close < basis and rsi < 50)
    strategy.close("Long")

plot(basis, "Middle", color=color.orange)
plot(upper, "Upper", color=color.red)
plot(lower, "Lower", color=color.green)
plot(sma200, "SMA 200", color=color.purple)

6. Reading BB Across Different Timeframes

TimeframeBB ApplicationPrimary Use
1m / 5mToo noisy, not recommendedScalping, but low win rate
15m / 1hSqueeze breakouts most effectiveIntraday swings
4hMiddle-band pullback + trend filter2-7 day swings
D / WTrend direction assessmentMonthly-scale allocation

7. Common Mistakes

❌ Treating BB as "absolute boundaries"

Price touching the upper band ≠ automatic sell. In a bull market, price can "Walk the Bands" — touching them on a dozen consecutive candles. You need to read the larger trend structure to decide whether fading the move is even appropriate.

❌ Cranking the parameters too short

Some people set length to 5 and mult to 1.0 because they "want it more sensitive" — the result is bands that are too narrow, signals flooding in, and a win rate collapsing to 30%. Stick with the 20 / 2.0 defaults.

❌ Entering during a Squeeze

A Squeeze is the dormant phase — the market isn't moving. Enter during this period and you'll get chopped up until you stop out. Wait for the Squeeze to end and a clear breakout to develop before you pull the trigger.

❌ Looking at BB without checking volume

If price breaks the upper band but volume doesn't expand, the odds of a fakeout are high. Real breakouts are almost always accompanied by a volume surge.

Get started

Ready to ship what you just learned?

Wire your strategy to a TradingView webhook and auto-execute on Binance / OKX / Bybit and 4 more.

Start free trial

8. Highlights from Bollinger's Own "19 Rules"

John Bollinger wrote Bollinger on Bollinger Bands, which lists 19 rules. Here are the most critical ones:

  • Rule 4: Price touching the bands is not, by itself, a signal — it requires confirmation from other indicators
  • Rule 6: During a Squeeze the market stores energy; the breakout direction marks the start of a major move
  • Rule 11: Walking the Bands is normal trending behavior — don't fight it
  • Rule 14: BB is a "relative" tool, not an "absolute" one — the upper band is just "relatively high" and the lower band is just "relatively low"