Skip to content
Indicators 9 min read

Bollinger Bands: calculation, %B, BandWidth and the squeeze

How Bollinger Bands are built from a 20-session average and standard deviation, with a worked example, %B, BandWidth, the squeeze and the limits of the bands.

Hypothetical daily chart with Bollinger Bands: the bands narrow while price moves sideways, then widen as price breaks upward and closes along the upper band, with BandWidth in the pane below.SqueezeWalking the bandUpper band20-session SMALower band51015BandWidth (%)
Daily candles on hypothetical data with Bollinger Bands (20 sessions, 2 standard deviations) and BandWidth below. BandWidth contracts to 1.67% in the squeeze. After price breaks upward, %B stays at 0.90 or higher for 15 consecutive sessions as the bands widen: price walks the upper band.

Bollinger Bands frame price with a volatility envelope around a 20-session average. Where the close sits within the bands and how wide they are describe recent behavior; a band touch or a squeeze does not predict the next move.

What Bollinger Bands are

Bollinger Bands, developed by John Bollinger in the 1980s, are three lines drawn over the price chart: a 20-session simple moving average in the middle, an upper band two standard deviations above it and a lower band two standard deviations below it. Because the distance to the bands is a standard deviation of recent closes, the bands widen when closes swing more and narrow when they settle.

Bollinger Bands at a glance
PropertyBollinger Bands
Middle band20-session simple moving average of the close
Upper bandMiddle band + 2 standard deviations
Lower bandMiddle band − 2 standard deviations
Standard deviationOf the same 20 closes, in the population form
Companion measures%B for the close’s position, BandWidth for the width
First valueAfter 20 closes

The bands are a relative frame, not support, resistance or price targets. They show whether the latest close is high or low compared with the recent average, measured in units of recent volatility.

Bollinger Bands calculation

All three lines use the same 20 closes. The standard deviation measures how far those closes spread around their mean.

middle band = SMA(20) = (sum of the last 20 closes) ÷ 20
variance = (sum of (close − middle band)²) ÷ 20
SD = √variance
upper band = middle band + 2 × SD
lower band = middle band − 2 × SD
SD
The population standard deviation of the same 20 closes.
2
The band multiplier. Twenty sessions and two standard deviations are Bollinger’s defaults.

Population or sample? Statistics distinguishes the population standard deviation, which divides by n, from the sample standard deviation, which divides by n − 1. Bollinger’s construction uses the population form, dividing by 20, and so does the Bollinger Bands overlay in TradeClever’s Stock Charts. Software that uses the sample form draws bands about 2.6% farther from the middle, because √(20 ÷ 19) = 1.026.

Edge case: if all 20 closes are identical, the standard deviation is 0 and both bands collapse onto the middle band. BandWidth is then 0, and %B, which divides by the distance between the bands, is undefined for that session.

A worked Bollinger Bands example

The example uses 22 hypothetical daily closes. The first table computes the bands for session 20 from sessions 1 to 20; the second shows how the bands respond to the next two sessions.

Closes and squared deviations from the 20-session mean, sessions 1–20
SessionClose ($)Close − mean ($)Squared deviation
140.10-0.250.0625
240.350.000.0000
339.90-0.450.2025
440.20-0.150.0225
540.55+0.200.0400
640.30-0.050.0025
739.95-0.400.1600
840.15-0.200.0400
940.45+0.100.0100
1040.70+0.350.1225
1140.40+0.050.0025
1240.05-0.300.0900
1340.25-0.100.0100
1440.60+0.250.0625
1540.350.000.0000
1640.50+0.150.0225
1740.20-0.150.0225
1840.65+0.300.0900
1940.80+0.450.2025
2040.55+0.200.0400
middle band = 807.00 ÷ 20 = 40.35
variance = 1.2050 ÷ 20 = 0.06025
SD = √0.06025 = 0.2455
upper band = 40.35 + 2 × 0.2455 = 40.84
lower band = 40.35 − 2 × 0.2455 = 39.86
%B = (40.55 − 39.86) ÷ (40.84 − 39.86) = 0.70
BandWidth = (40.84 − 39.86) ÷ 40.35 × 100 = 2.43%
Bands, %B and BandWidth, sessions 20–22
SessionClose ($)Middle band ($)SD ($)Upper band ($)Lower band ($)%BBandWidth (%)
2040.5540.350.245540.8439.860.702.43
2141.7040.430.376641.1839.681.343.73
2242.0540.520.515341.5539.481.245.09

Session 21 closes at 41.70, above the upper band of 41.18, so %B exceeds 1 (1.34). The jump also enters the standard deviation: BandWidth rises from 2.43% to 3.73% in one session and to 5.09% in the next. The bands react to the move that crossed them.

With the sample standard deviation, dividing by 19, the session 20 bands would be 40.85 and 39.85 instead of 40.84 and 39.86. Values are rounded for display; each step uses the unrounded figures.

Bollinger Bands %B explained

%B, which Bollinger introduced alongside the bands, turns the close’s position relative to the bands into a number: 1 at the upper band, 0.5 at the middle band and 0 at the lower band.

%B = (close − lower band) ÷ (upper band − lower band)
%B for different closes against the session 20 bands
Close ($)%BPosition
41.001.16Above the upper band
40.841.00At the upper band
40.350.50At the middle band
39.860.00At the lower band
39.50-0.37Below the lower band

%B above 1 or below 0 is not an error: it says the close is outside the bands. Because %B is normalized, it can be compared across stocks and used to look for divergence. A new price high with a lower %B means the close is less extended, relative to recent volatility, than it was at the prior high.

Bollinger Band width calculation

BandWidth measures the distance between the bands relative to the middle band, so it can be compared over time and across stocks.

BandWidth = (upper band − lower band) ÷ middle band
BandWidth (%) = BandWidth × 100

With 2 standard deviations the bands are 4 SD apart, so BandWidth equals 4 × SD ÷ middle band: four times the coefficient of variation of the 20 closes. For session 20 of the example that is 4 × 0.2455 ÷ 40.35 × 100 = 2.43%.

Some platforms show BandWidth as a ratio, 0.0243, and others as a percentage, 2.43; the information is the same. The middle band of a stock price is always positive, so the division is always defined.

The Bollinger Band squeeze explained

A squeeze is a period when BandWidth falls to an unusually low level for that stock. Bollinger’s own benchmark is BandWidth at its lowest reading in about six months. It describes a quiet market in which closes cluster tightly around their average.

In the illustration on this page, BandWidth contracts from 15.35% to 1.67% while price moves sideways, then expands to 17.84% after price breaks upward.

Bollinger observed that periods of low volatility tend to give way to periods of higher volatility, which is why traders watch for squeezes. A squeeze does not say when the expansion comes or in which direction, and the first move out of a squeeze can reverse. Many readers wait for a close outside the bands and look at volume and the broader trend before drawing conclusions.

A squeeze is relative to the stock’s own history. A BandWidth of 3% can be a squeeze for one stock and an ordinary reading for another.

How to read Bollinger Bands on a stock chart

Read the bands in three steps: the middle band’s direction, the close’s position within the bands and the width of the bands.

  1. Direction. A rising middle band means the 20-session average is climbing; in an advance, pullbacks that hold near the middle band describe an orderly trend.
  2. Position. Closes near the upper band are high relative to recent volatility, and closes near the lower band are low; %B puts a number on it.
  3. Width. Widening bands mean rising volatility and narrowing bands falling volatility; BandWidth puts a number on it.
  4. Context. A touch of an outer band means different things in a range and in a trend. In a range, the outer bands often frame the swings; in a trend, repeated touches of one band are normal.

In TradeClever, open Stock Charts and add Bollinger Bands. The period and the number of standard deviations are configurable, with 20 and 2 as defaults. For the basics of candles and chart ranges, see reading a stock chart.

Stock price walking the upper Bollinger Band

In a strong advance, price can close at or near the upper band session after session, a behavior Bollinger calls walking the band. It happens because each high close lifts the average and widens the standard deviation, so the band climbs along with price.

In the illustration, %B stays at 0.90 or higher for 15 consecutive sessions after the squeeze breaks, while the close climbs from 38.22 to 42.75.

A close at the upper band is therefore not evidence that an advance is exhausted. A walk ends when closes stop reaching the band; many readers watch whether pullbacks hold above the middle band. The mirror image, walking down the lower band, occurs in strong declines.

Touching or closing above the upper band describes strength relative to recent volatility. On its own it is not a reason to expect a reversal.

Bollinger Bands versus Keltner Channels

Keltner Channels are another envelope around an average. In the form popularized by Linda Bradford Raschke, the center is an exponential moving average and the width is a multiple of average true range, commonly a 20-period EMA with bands 2 ATRs away. Chester Keltner’s original 1960 version used a moving average of the daily high–low range around an average of the typical price.

Bollinger Bands and Keltner Channels
AspectBollinger BandsKeltner Channels (ATR form)
Center line20-session SMA of the closeEMA, often 20 periods
Width set byStandard deviation of closesAverage true range
Responds toHow far closes spread from their averageHow large each session’s range is, gaps included
Reaction to one large closeWidens at once, then narrows when that close leaves the windowWidens gradually, following ATR’s smoothing

Because the two envelopes measure volatility differently, some traders compare them. Bollinger Bands drawn inside Keltner Channels mark a period when closes are tightly clustered relative to typical ranges, one way of defining a squeeze. TradeClever’s charts draw Bollinger Bands; average true range explains the measure behind Keltner widths, and a moving average envelope uses a fixed percentage instead.

Limitations of Bollinger Bands

Bollinger Bands describe recent closes. Their limits come from the window, the settings and the statistics behind them.

  • Two standard deviations is a scale, not a probability. Price data are not normally distributed, and the share of closes outside the bands varies by stock and period.
  • They lag. Both the average and the standard deviation use the last 20 closes.
  • One large move distorts them for 20 sessions and then drops out of the window at once.
  • Settings matter. The defaults of 20 and 2 are conventions, not values tuned to any stock.
  • A band is not a level. Touches happen in trends as well as at turning points.
  • They see closes only. Intraday ranges and gaps enter only through the closes they leave behind.

Sources

  • John Bollinger, Bollinger on Bollinger Bands (McGraw-Hill, 2001)
  • John Bollinger, Bollinger Band Rules (checked October 1, 2026)
  • Chester W. Keltner, How to Make Money in Commodities (1960)

Read our data and methodology notes for calculation context. This guide explains research tools and observations. It does not recommend a trade or investment.

Follow your curiosity

One good question leads to another.

All guides
Make room for better research

Put your curiosity to work.

Build a scan with filters or CleverScan rules. Explore the results. Find your next idea.

Open a stock chart