Technical Analysis
Bollinger Bands, ATR and Keltner Channels Explained
Price cannot tell you how far a stock usually travels in a day. That missing dimension is the whole job of a volatility indicator, and both calculations are short.
Two stocks print the same chart shape. One of them moves 0.9% on an ordinary day and the other moves 3.8%. Price alone cannot tell them apart. A stop placed by eye will be sensible on one chart and absurd on the other. Volatility indicators supply that missing dimension. Both of the standard ones are short enough to compute by hand.
Bollinger Bands, with the standard deviation done properly
The middle band is a 20-period simple moving average of closes. The outer bands sit two standard deviations above and below it.
Standard deviation is sqrt(sum of squared deviations from the mean / n). Here it is on five closes. It behaves identically to the 20 the default uses.
| Close | Mean | Deviation | Squared |
|---|---|---|---|
| 48.00 | 50.00 | -2.00 | 4.00 |
| 50.00 | 50.00 | 0.00 | 0.00 |
| 52.00 | 50.00 | 2.00 | 4.00 |
| 49.00 | 50.00 | -1.00 | 1.00 |
| 51.00 | 50.00 | 1.00 | 1.00 |
The squared deviations sum to 10.00. So the variance is 10.00 / 5 = 2.00 and the standard deviation is sqrt(2.00) = 1.414. The bands are 50.00 + (2 x 1.414) = 52.83 and 50.00 - (2 x 1.414) = 47.17.
One detail that the charting packages do not agree on. Dividing by n gives the population standard deviation, which is what Bollinger’s original definition uses. Dividing by n - 1 gives the sample version. On these five closes that is sqrt(10.00 / 4) = 1.581, putting the bands at 53.16 and 46.84. The difference is 0.33 on a $50 stock. That is enough to change whether a close counts as a touch. If two platforms disagree about a band touch, this is usually why. The gap shrinks as the window lengthens.
Two further readings come free. Bandwidth measures the channel against price: (52.83 - 47.17) / 50.00 = 11.3%. And %b locates a close inside the channel: at 51.00, (51.00 - 47.17) / (52.83 - 47.17) = 3.83 / 5.66 = 0.68, so the close sits 68% of the way up.
The squeeze, and the trap in how it resolves
Bandwidth contracting to the low end of its own recent range is a squeeze. Closes have clustered and the name has gone quiet. Volatility does cluster in time, so quiet stretches are often followed by active ones. That tendency is the whole of the idea. It supplies no direction, which means the direction has to come from the break and the size has to assume the first break can be false. A close back inside the bands is the natural invalidation.
Here is the part that costs people money. It is a consequence of the arithmetic, and the market did nothing. The bands are narrow during a squeeze, so the first move outside them looks enormous in band terms immediately. Then the standard deviation recalculates with that large move inside the window, the bands widen fast, and price that appeared to be far outside the channel is back inside it two sessions later without having reversed at all. Judge the size of the break against the stock’s own average true range. That measure does not re-scale itself so violently.
Walking the band
In a powerful advance price closes near or above the upper band session after session, because the advance is what is generating the dispersion that sets the band width in the first place. The indicator is measuring its own cause.
Selling each of those touches is the band version of fading every overbought RSI reading, and it fails for exactly the same reason, which is that the trend is producing the readings. The momentum indicators guide covers why that behaves so badly in a trend.
Average true range, including a gap
True range for a period is the largest of high - low, |high - previous close| and |low - previous close|. The previous close is in there so the measure counts overnight gaps. A plain high minus low ignores them entirely.
| Day | High | Low | Prev close | H - L | |H - PC| | |L - PC| | True range |
|---|---|---|---|---|---|---|---|
| 1 | 51.20 | 49.80 | 50.00 | 1.40 | 1.20 | 0.20 | 1.40 |
| 2 | 52.60 | 50.90 | 51.00 | 1.70 | 1.60 | 0.10 | 1.70 |
| 3 | 52.80 | 50.20 | 52.40 | 2.60 | 0.40 | 2.20 | 2.60 |
| 4 | 50.80 | 48.30 | 50.60 | 2.50 | 0.20 | 2.30 | 2.50 |
| 5 | 49.00 | 47.20 | 48.60 | 1.80 | 0.40 | 1.40 | 1.80 |
The five true ranges sum to 10.00, so ATR(5) = 10.00 / 5 = 2.00.
Now the gap. Day 5 closed at 47.60. Bad news arrives overnight. Day 6 trades between 44.50 and 46.00, never touching the previous close.
| Day | High | Low | Prev close | H - L | |H - PC| | |L - PC| | True range |
|---|---|---|---|---|---|---|---|
| 6 | 46.00 | 44.50 | 47.60 | 1.50 | 1.60 | 3.10 | 3.10 |
High minus low reports 1.50. That would make day 6 the quietest session of the week. True range reports 3.10. That is what happened to anybody holding the stock overnight. That third column is the entire reason the measure exists.
Wilder’s smoothing then updates the average in place: ATR today = ((prior ATR x (n - 1)) + today's true range) / n. At n of 5, ((2.00 x 4) + 3.10) / 5 = 11.10 / 5 = 2.22. The standard period is 14, where one gap of that size would move the average far less.
From ATR to a share count
ATR is expressed in the stock’s own units. That makes it directly usable for sizing.
| Step | Arithmetic | Result |
|---|---|---|
| Entry | Decided from a level | 52.00 |
| ATR | From the table above | 2.00 |
| Stop distance at 2 x ATR | 2 x 2.00 |
4.00 |
| Stop price | 52.00 - 4.00 |
48.00 |
| Risk budget, 1% of $50,000 | 50,000 x 0.01 |
$500 |
| Position size | 500 / 4.00 |
125 shares |
As a percentage of price, 2.00 / 52.00 = 3.8% a day. Set that against a stock running 0.9% and the same stop distance in dollars means completely different things, which is how a reasonable-looking stop turns into noise on one chart and into an enormous loss on the other.
Keltner Channels, and where both measures mislead
Keltner Channels share the shape and change the inputs. The centre line is a 20-period exponential moving average. The bands sit a multiple of ATR above and below it, commonly 2 times ATR.
| Feature | Bollinger Bands | Keltner Channels |
|---|---|---|
| Centre line | 20-period simple moving average | 20-period exponential moving average |
| Width driver | Standard deviation of closes | Average true range |
| Counts overnight gaps | No, closes only | Yes, through the true range |
| Effect of one wild session | Sharp, because the deviation is squared | Milder, one value inside an average |
ATR moves more smoothly than standard deviation. The two disagree in a way that is worth having. A widely used definition of a squeeze is the Bollinger Bands sitting entirely inside the Keltner Channels, which says dispersion of closes has dropped below the level implied by recent trading ranges.
Three failure modes, all visible in the formulas. Standard deviation assumes well-behaved data. Under a normal distribution, two standard deviations would cover about 95% of observations. Stock returns have fatter tails than that, so a three standard deviation session is nothing like the once-in-a-decade event the arithmetic implies, and the bands will be broken more often than the textbook suggests.
Both measures also carry their own history for a fixed number of sessions. One violent day stays inside a 14-day ATR for 14 sessions and inside a 20-day standard deviation for 20, so a stock can look far more volatile than it is for weeks after the event that caused it, then abruptly look calm on the day that session drops out of the window. Nothing about the stock changed on either date.
And both are backward looking by construction. An ATR of 2.00 describes the last 14 sessions. On the day before an earnings report it says nothing at all about the range that report will produce, and widening the stop or cutting the size ahead of a scheduled event is a judgement the indicator cannot make for you.
The stock screener filters on moving average position, RSI and relative volume. That supplies the trend and participation context to read a band reading against. Read the moving averages guide for the centre lines these channels are built on, the support and resistance guide for where the invalidation belongs, and the technical analysis pillar for the order in which to use any of it. The chart patterns and indicators quiz covers the calculations on this page.
Frequently asked questions
How are Bollinger Bands calculated?
The middle band is a 20-period simple moving average of closing prices. The upper and lower bands sit two standard deviations of those same 20 closes above and below the middle band. Because standard deviation rises when recent closes are spread out, the bands widen in active periods and contract in quiet ones.
Does price touching the upper Bollinger Band mean overbought?
No. The bands adjust to recent dispersion, so a touch only reports that the close is unusual relative to the last 20 sessions. In a strong trend price can close near the upper band for weeks, a behaviour known as walking the band, and selling each touch means fighting the trend repeatedly.
What is a Bollinger Band squeeze?
A squeeze is a period when the bands narrow sharply because recent closes have clustered together. It describes a quiet market, and quiet periods are often followed by active ones. The squeeze supplies no direction whatsoever, so trading it means waiting for a break and taking the direction from price.
How do you calculate ATR?
For each period take the true range, which is the largest of the high minus the low, the absolute difference between the high and the previous close, and the absolute difference between the low and the previous close. Average those values over 14 periods. Bringing the previous close into it is what makes ATR count overnight gaps.
How do I use ATR to set a stop loss?
Multiply ATR by a factor, commonly 2 or 3, and place the stop that distance from your entry. With an entry at 52 and an ATR of 2, a two times ATR stop sits at 48 and risks 4 per share. The aim is to put the stop outside the stock's ordinary daily movement so a quiet session cannot remove you.
What is the difference between Bollinger Bands and Keltner Channels?
Bollinger Bands use the standard deviation of closing prices, while Keltner Channels use average true range around an exponential moving average. ATR includes the highs, the lows and the gaps, so Keltner Channels respond to intraday range while Bollinger Bands respond only to how spread out the closes were.