GUIDE

Bollinger Bands explained, and how to write them as a condition

Indicators explained · 5 min read

Bollinger Bands are a moving average with a band drawn a set distance above and below it — and the distance is not fixed. It is a multiple of how much price has been varying lately, so the bands widen when the market is moving and narrow when it is quiet. That one property is what every comparison on them is about.

What they measure

The middle band is a simple moving average of the close — twenty bars by default. The upper and lower bands sit a number of standard deviations above and below it, two by default. Standard deviation is a measure of how far closes have strayed from their average over those twenty bars, so the bands are a picture of recent variability drawn around a picture of recent level.

Read literally: price at the upper band is about two standard deviations above its twenty-bar average, which over the last twenty bars has been an unusual place to be. That is a statement about the recent past of this market. It is not a statement that price will turn round — in a strong trend, price can ride the band for a long way.

The two settings

  1. Period — how many bars the average and the deviation are measured over. Twenty is the default. Shorter follows price more closely and the bands react faster; longer gives a slower average and steadier bands. As with every indicator here, it is twenty bars of the timeframe the condition reads.
  2. Standard deviations — how far out the bands sit. Two is the default. Lower and price reaches the bands more often; higher and reaching one becomes rarer.

Writing them as a condition

These are the comparisons SixOne8 offers, in the builder's own words.

  1. Price reaches the upper band / the lower band / the middle band. True on a bar where price gets within a small tolerance of that band. The tolerance is a setting of its own, as a percentage, so a close that stops just short still counts.
  2. Price re-enters from the upper band / from the lower band. True on the bar where price, having been outside or at the band, comes back inside it. A moment rather than a state, and the one people usually mean when they talk about a band "rejection".
  3. Band width above / below a level. How far apart the bands are, as a percentage of price. Narrow bands mean the market has been quiet; wide bands mean it has been moving. The comparison takes a threshold so one condition reads the same on every market.

Bollinger Bands(20, 2) on 1h  ·  price re-enters from the lower band

Bollinger Bands(20, 2) on 4h  ·  band width below  ·  0.5%

The squeeze

The second condition above is what traders call a squeeze: the bands have pulled in because the market has gone quiet. It is a description of the recent past, and it is often paired with a second condition that fires when the quiet ends — a close through a band, a moving-average crossing, a Supertrend flip. The squeeze condition says the context is "has been quiet"; the other condition says the moment is "has just moved". Neither says which way, which is why a strategy using them still needs a direction and usually a trend condition on a higher timeframe.

What the bands do not know

Where price goes after it reaches one. "Reaches the lower band" fires just as readily at the start of a fall as at the end of one, and on a trending market it fires repeatedly on the way down. Whether the moments a band condition fired moved any differently from a random moment, on the market you care about, is what an entry check measures — over the history it was run on, and nothing beyond it.

Next