Skip to main content

Bollinger Bands Explained

TL;DR

Bollinger Bands are a volatility envelope: a 20-period SMA in the middle with two bands placed two standard deviations above and below it. When volatility is low, the bands squeeze together. When it expands, they widen. Bands are best used as a volatility gauge and mean-reversion reference, not as blunt overbought/oversold signals.

How Bollinger Bands are built

Created by John Bollinger in the 1980s, the standard formula:

  • Middle band = 20-period SMA of closing price
  • Upper band = middle + (2 × standard deviation of last 20 closes)
  • Lower band = middle − (2 × standard deviation of last 20 closes)

Because standard deviation is a volatility measure, the bands automatically expand in volatile conditions and contract in quiet ones. That self-adjusting property is the whole point.

The two patterns that matter

1. The Squeeze. When bands contract to historically narrow widths, volatility is low and a breakout is statistically likely. The squeeze doesn't predict direction — only that a move is coming. Pair it with a breakout trigger (price closing beyond a prior range high/low).

2. Mean Reversion. Price tagging the upper band in a range-bound market often reverts to the middle band. Same for the lower band. Critical caveat: in a trending market, price will "walk the band" — tag and stay extended. Band-tagging alone is not a reversal signal.

Settings

Default: 20-period SMA, 2 standard deviations. Bollinger himself recommends not changing these without a reason.

You can play with the multiplier (1.5 for tighter bands, 2.5 for wider) if you want more or fewer band-touches, but the 20/2 default is the version everyone else is watching — which gives it self-fulfilling weight.

Bollinger Bands in Pine Script (v6)

//@version=6
indicator("Bollinger Bands + Alerts", overlay=true)

length = input.int(20, "Length")
mult = input.float(2.0, "StdDev Multiplier")

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

plot(basis, color=color.orange, title="Basis")
p1 = plot(upper, color=color.blue, title="Upper")
p2 = plot(lower, color=color.blue, title="Lower")
fill(p1, p2, color=color.new(color.blue, 95))

// Bandwidth squeeze detection (narrow range relative to recent history)
bw = (upper - lower) / basis
bwLowest = ta.lowest(bw, 50)
squeeze = bw <= bwLowest * 1.05

plotshape(squeeze, title="Squeeze", style=shape.circle, location=location.bottom, color=color.yellow, size=size.tiny)

tagUpper = high >= upper
tagLower = low <= lower

if ta.crossover(close, upper)
alert("Price closed above upper BB on " + syminfo.ticker, alert.freq_once_per_bar_close)
if ta.crossunder(close, lower)
alert("Price closed below lower BB on " + syminfo.ticker, alert.freq_once_per_bar_close)

Mean reversion strategy outline

  1. Regime filter — only trade reversion when ADX < 20 (indicating a range, not a trend).
  2. Setup — price tags the lower band.
  3. Trigger — bullish engulfing or hammer on the next bar.
  4. Stop — ATR(14) × 1 below the low.
  5. Target — middle band (the 20 SMA).

Inverse for shorts. Expected win rate: 55–65%, reward-to-risk typically ~1:1.

Breakout strategy outline

  1. Setup — squeeze (bandwidth at a 50-bar low).
  2. Trigger — price closes beyond the squeeze range.
  3. Entry — next bar open.
  4. Stop — opposite side of the squeeze range.
  5. Target — 2× the squeeze range, or trail with the basis line.

Lower win rate (~40%), higher reward-to-risk (2:1+).

Common mistakes

  • Treating band tags as automatic reversals. In a strong trend, price will walk the upper band for 30 bars. Fading every tag will bankrupt you.
  • Using bands without a regime filter. Mean reversion in a trend fails; breakouts in a chop fail. Filter first.
  • Only looking at touches. The shape of the bands (narrowing, widening, parallel) tells you more than which band price just touched.

How to automate Bollinger Band signals with CrossTrade

Convert the indicator into a strategy() and add this alert message to route signals through CrossTrade:

key=YOUR-SECRET-KEY;
command=place;
account=Sim101;
instrument=ES 03-26;
action={{strategy.order.action}};
qty={{strategy.order.contracts}};
order_type=market;
tif=day;
sync_strategy=true;
market_position={{strategy.market_position}};
prev_market_position={{strategy.prev_market_position}};

Frequently Asked Questions

What do Bollinger Bands actually measure?

Price volatility relative to a moving average. The bands sit two standard deviations above and below a 20-period SMA, so they expand when prices are volatile and contract when prices are calm.

Is a Bollinger Band touch a sell signal?

Not by itself. In a ranging market, band tags often precede reversion. In a strong trend, price can ride the band for many bars. Always combine band signals with trend context — ADX, the 200 EMA, or a higher-timeframe structure read.

What is a Bollinger Band squeeze?

A squeeze is when the distance between the upper and lower bands contracts to a multi-bar low. It signals that volatility is compressed and a larger move is statistically likely — but it does not predict direction. Wait for a breakout bar.

Bollinger Bands vs Keltner Channels — what's the difference?

Both are volatility envelopes. Bollinger uses standard deviation of price; Keltner uses ATR. Keltner bands are smoother and less prone to whipsaws in volatile conditions. Some traders layer them — when the Bollinger bands contract inside the Keltner channels, that's a stricter squeeze signal.