Quantitative Analysis · Data Science · Machine Learning

# Bollinger Bands

## What are Bollinger Bands and how is it calculated?

Bollinger Bands are a technical analysis indicator that is used to measure the volatility of a financial instrument. They are plotted on a chart as three lines: a simple moving average (SMA) in the middle, and an upper and lower band that are plotted at a certain standard deviation above and below the SMA.

The standard deviation is a measure of the dispersion of a set of data from its mean. It is calculated as follows:

1. Calculate the mean (average) of the data set.
2. For each data point, calculate the difference between the data point and the mean.
3. Square the differences calculated in step 2.
4. Calculate the mean of the squared differences.
5. Take the square root of the mean of the squared differences to get the standard deviation.

The standard deviation is used to calculate the upper and lower Bollinger Bands as follows:

1. Calculate the SMA of the data set.
2. Multiply the standard deviation by a factor (usually 2) to get the distance between the SMA and the upper and lower bands.
3. Add the distance to the SMA to get the upper band, and subtract the distance from the SMA to get the lower band.

Bollinger Bands are typically used to help traders identify trends and potential buy and sell signals. When the price of a financial instrument moves outside of the upper or lower Bollinger Band, it is considered overbought or oversold, respectively. Some traders may use this information to enter or exit trades, or to set stop-loss orders.

## Bollinger Bands History

The Bollinger Band indicator was developed by John Bollinger in the 1980s. Bollinger was a financial analyst and technical trader who wanted to create a more useful and efficient way to measure volatility in financial markets.

Before the development of Bollinger Bands, traders used a simple moving average to gauge market trends and potential buy and sell signals. Bollinger recognized that this approach had its limitations, and that it was important to consider not just the average price of a financial instrument, but also the dispersion of prices around the average.

Bollinger’s solution was to add a standard deviation component to the moving average, which created the Bollinger Bands that are widely used today. The standard deviation is a measure of the dispersion of a set of data from its mean, and it is used to calculate the distance between the upper and lower Bollinger Bands and the simple moving average.

Bollinger Bands have become a popular tool among traders and investors, and are now included in many charting software packages and trading platforms.

## How to use Bollinger Bands in an Algorithmic trading strategy?

There are several ways that Bollinger Bands can be used in an algorithmic trading strategy, including the following:

1. Band breakout: One common strategy is to buy or sell when the price of a financial instrument breaks through the upper or lower Bollinger Band. This can be used as a signal to enter or exit a trade.
2. Band reversal: Another strategy is to buy or sell when the price of a financial instrument touches the upper or lower Bollinger Band and then reverses direction. This can be used as a signal to enter or exit a trade.
3. Band squeeze: When the upper and lower Bollinger Bands are close together, it indicates that the price of the financial instrument is not moving much and is relatively stable. This is known as a Bollinger Band squeeze. Some traders may use this as a signal to enter or exit a trade, as it suggests that the price may be about to break out in one direction or another.
4. Band width: The distance between the upper and lower Bollinger Bands is known as the band width. Some traders may use the band width as a measure of volatility, with a wider band indicating higher volatility and a narrower band indicating lower volatility. This information can be used to make decisions about when to enter or exit a trade.

It is important to note that Bollinger Bands should not be used in isolation to make trading decisions. It is always important to consider multiple technical and fundamental analysis tools and to conduct your own research before making any investment decisions. It is also important to consult with a financial advisor or professional before implementing any algorithmic trading strategy.