The Flaw of Bollinger Bands

The Flaw of Bollinger Bands

21 August 2018, 21:02
Steven Brown
0
323

Bollinger bands apply the concept of standard deviation to technical analysis of markets. In the field of statistics, "standard deviation" is a measure of the degree of dispersion of data points from the average or mean. In the normal distribution associated with random data points, 68% of all points lie within one standard deviation from the mean, 95% lie within two standard deviations, and 99.7% lie within three standard deviations from the mean. From the distribution of data points, the probability as to where any random data point will occur can be inferred.

As standard deviation defines a level separating regions of differing probability, plotting it in relation to a simple moving average provides a visual indicator of zones or "bands" that tend to enclose excursions of price, or to show where price has extended outside its usual range. The concept is sound, but to me, the appearance of Bollinger bands did not seem quite right. They seem to balloon in response to price swings, instead of forming a channel aligned with the SMA. I looked at the source code of Bollinger band technical indicators and discovered a flaw in the algorithm that calculates how the upper and lower bands are plotted. I found a way to correct that flaw and published Probability Indicator which uses the improved algorithm to plot volatility bands.        

In statistics, standard deviation is calculated from a fixed or static set of data, where the average or mean is regarded to be the same for all data points. In markets, the data is dynamic, continually changing over time. For each data point, the moving average has a new value, as the new data point is added and the oldest point is discarded from the average. Price deviates above and below the plot of the SMA over time, and it is useful to the trader to gauge that deviation in statistical terms. Therefore, volatility bands should be plotted in terms of standard deviation of price from the SMA as it evolves through time.

For example, let's say we have two arrays of data. One is an array of closing prices of the last 20 bars, indexed Close[1] through Close[20], where 1 is the index of the most recent completed bar, and 20 is the index of the bar 20 periods ago. The other is an array of the SMAs calculated at each of the last 20 bars, indexed SMA[1] through SMA[20], where 1 is the index of the SMA calculated at the most recent completed bar, and 20 is the index of the SMA calculated at the time of the bar 20 periods ago. Note that SMA[1] is calculated by averaging Close[1] through Close[20], SMA[2] is calculated by averaging Close[2] through Close[21], and so on, until SMA[20] is calculated by averaging Close[20] through Close[39], the closing price of the bar 39 periods ago. Standard deviation should be calculated by squaring the differences Close[n] - SMA[n], where n is 1 through 20, calculating the average of the squares, and taking the square root of that average. 

Bollinger bands use a different method of calculating standard deviation. Compared to the above example, standard deviation is calculated by squaring the differences Close[n] - SMA[1], where n is 1 through 20, calculating the average of the squares, and taking the square root of that average. The key difference is that only the current value of the SMA is used in calculating the differences. The set of data in the SMA is regarded to be static, where the average is the same at the time of each data point, which is not the case with a moving average. The point plotted for the band is the standard deviation of the 20 data points from the average of those points, so it is a measure of volatility only among those 20 bars, not a measure of the volatility of prices relative to the plot of moving averages. That accounts for the ballooning characteristic of Bollinger bands.

The flaw in the Bollinger calculation of standard deviation is evident by comparing the percent of closing prices that lie within one standard deviation from the SMA. For the 30-period SMA on the hourly graph of the EUR/USD currency pair, the method used in Probability Indicator finds the percent of bars closing within one standard deviation from the SMA to be 60.7%, over a span of four years. That is somewhat less than the 68% expected in a normal distribution, but the distribution of prices is not expected to be perfectly random. Using the Bollinger calculation, the percent of bars closing within one standard deviation from the SMA is 43.8%, casting doubt on the method used to derive the value of standard deviation.


Figure 1

Figure 1

Figure 1 shows Bollinger bands plotted at 1.5 standard deviations. They do not track the SMA well, tending to bulge in response to price swings. 


Figure 2

Figure 2

Figure 2 shows volatility bands plotted by Probability Indicator at 1.5 standard deviations. They tend to track the SMA, forming a channel that delimits price swings on the side of the trend.       



Share it with friends: