The Bollinger Bands Width Indicator.

Coding & Presenting the Bollinger Bands Width Indicator in Python.

Sofien Kaabar, CFA
7 min readJan 1, 2022


We can transform Bollinger bands so that we measure their width, thus helping us understanding whether Bollinger bands-based strategies will work better or not. This article presents the details of the Bollinger bands width indicator.

I have just released a new book after the success of my previous one “The Book of Trading Strategies”. It features advanced trend-following indicators and strategies with a GitHub page dedicated to the continuously updated code. Also, this book features the original colors after having optimized for printing costs. If you feel that this interests you, feel free to visit the below Amazon link, or if you prefer to buy the PDF version, you could contact me on LinkedIn.

Bollinger Bands

What are the Bollinger bands? When prices move, we can calculate a moving average (mean) around them so that we better understand their position regarding their mean. By doing this we can also calculate where do they stand statistically. But first we need to understand the concept of the normal distribution curve which is the essence of statistics and the foundation of statistical theory.

An example of the Normal Distribution Curve.

The above curve shows the number of values within a number of standard deviations. For example, the area shaded in red represents around 1.33x of standard deviations away from the mean of zero. We know that if data is normally distributed then:

  • About 68% of the data falls within 1 standard deviation of the mean.
  • About 95% of the data falls within 2 standard deviations of the mean.
  • About 99% of the data falls within 3 standard deviations of the mean.



Sofien Kaabar, CFA

Top writer in Finance, Investing, Business | Trader & Author