Skip to content

Glossary

Bollinger Bands: Formula, Settings and How to Read

Bollinger Bands are a volatility indicator made of a middle 20-period simple moving average and upper and lower bands set two standard deviations above and below it. Bands widen when volatility rises and narrow (a 'squeeze') when it falls. On TradingLead, add 'Bollinger Bands' from the Indicators dialog, or use ta.bb in Pine.

Definition

Bollinger Bands, developed by John Bollinger, place an envelope around price that adapts to volatility. They have three lines: a middle band (a moving average) and an upper and lower band set a number of standard deviations away from it. Because standard deviation grows when prices swing more, the bands automatically widen in volatile periods and contract in quiet ones.

Formula

With the standard settings (20, 2):

  1. Middle band = SMA(20) of close — see moving average.
  2. Standard deviation (SD) = how far the last 20 closes spread around that average.
  3. Upper band = Middle + 2 × SD
  4. Lower band = Middle − 2 × SD

Example: if the 20-period SMA is 500 and SD is 8, the upper band is 500 + 16 = 516 and the lower band is 500 − 16 = 484.

Two related measures:

  • %B = (Close − Lower) ÷ (Upper − Lower) — where price sits inside the bands (1 = upper band, 0 = lower band).
  • Bandwidth = (Upper − Lower) ÷ Middle — how wide the bands are, used to spot squeezes.

How traders read it

  • Relative highs and lows: closes near the upper band are high relative to recent volatility; near the lower band, low.
  • Mean reversion in ranges: in sideways markets, price often moves from one band back toward the middle.
  • Band walk in trends: in strong trends, price can hug the upper (or lower) band for many candles.
  • Squeeze: very narrow bands signal low volatility; a breakout often follows, direction unknown.
  • Combination: many traders pair bands with a momentum tool such as RSI.

Common settings

StyleLengthStd. dev.
Standard202
Short-term101.5
Long-term502.5

Pitfalls

  • A band touch is not a signal by itself; trends can ride the band.
  • Squeezes don't predict direction.
  • Not a probability guarantee: prices are not normally distributed, so "95% inside the bands" is only a rough idea.
  • Lag: the middle band is a moving average and lags price.

How to add Bollinger Bands on TradingLead

  1. Open a chart at tradinglead.in/charts.
  2. Click Indicators, search Bollinger Bands and click it. Related built-ins include Bollinger Bands %B and Bollinger Bands Width.
  3. Open its settings to change length, standard deviation and source.

To customise them in Indicator Studio (documented Pine v5/v6 subset; ta.bb returns a typed tuple):

//@version=6
indicator("BB custom", overlay=true)
[middle, upper, lower] = ta.bb(close, input.int(20, "Length"), input.float(2.0, "StdDev"))
plot(middle, "Basis")
u = plot(upper, "Upper")
l = plot(lower, "Lower")
fill(u, l, color=color.new(color.blue, 90))

Educational content only — not investment advice.

Frequently asked questions

What does it mean when price touches the upper Bollinger Band?
Price is relatively high compared with its recent average and volatility. In ranges this can precede a pullback; in strong trends price can 'walk the band' for many candles. A touch alone is not a sell signal.
What is a Bollinger Band squeeze?
A period when the bands narrow sharply because volatility is low. Squeezes are often followed by a larger move, but the bands do not tell you which direction.
What are the standard Bollinger Band settings?
20-period simple moving average with bands at 2 standard deviations, using the close. Some traders use 10 and 1.5 for shorter-term charts or 50 and 2.5 for longer-term charts.

Last updated: