Have you heard about Bollinger Bands, but not quite sure what they are or how you use them to improve your trading? In this article, I’m going to explain everything you need to know about Bollinger Bands so that you can start using them to improve your trading.

You can watch the video below which explains everything (21 minutes long), or just keep scrolling down and read the blog post below… either way, please comment at the bottom of the post to let me know what you think and any questions you may have so I can help you out.


What are Bollinger Bands?

Bollinger Bands was invented by John Bollinger during the mid 1980s. They’ve been around for a very long time and is a really powerful technical indicator that can be used in a number of different ways.

The Bollinger Band chart below is plotted in AmiBroker, and I’ve got the daily stock chart of a stock called Afterpay in Australia.

The ultimate guide to bollinger bands - what are bollinger bands

As illustrated in the Bollinger Band chart above, Bollinger Bands consists of three components:

Simple moving average: A simple moving average is the center line of the Bollinger Band and this can be any length that you want depending on what you’re trying to achieve with the Bollinger Band. For short term signals you might use a 5-14 day period, for a long term breakout or trend following system you might use 20-50 days.

Upper Band: The second component is the upper band which is the simple moving average plus some multiple of the standard deviation. Typically, the most commonly used settings for the Bollinger Bands are two-standard deviations. That means you take the X bar simple moving average, and add two times the standard deviation of price moves over the last X bars to it to get the top band.

Lower Band: The third component is the bottom Bollinger Band, so that’s the simple moving average minus X times the standard deviation.

The two input parameters for the Bollinger Band calculate are the number of bars for the moving average and standard deviation calculation (this is the same parameter value used in each) and the multiple of standard deviation used to determine the width of the bands.

Bollinger Band Formula

As explained in the section above, there are three components to the Bollinger Band calculation. The Moving Average, the upper band and the lower band.

The Bollinger Band Formula for each component is below:

Formula 1

The simple moving average is calculated on each bar adding together the closing price of the instrument for the X price bars. This sum is then divided by the number of bars in the moving average (X).

The upper Bollinger Band is calculated as the simple moving average plus Y times the standard deviation:

Formula 2

The lower Bollinger Band is calculated as the simple moving average minus Y times the standard deviation:

Formula 3

In this calculation the moving average and the standard deviation should use the same number of bars in their calculation.

The multiple of standard deviation most commonly used is 2, however this is a parameter that you can easily optimize when you are backtesting your trading system in Amibroker. I have cound values of 1 – 5 times the standard deviation useful for various purposes in different stock trading systems. Finally the multiple of standard deviation does not need to be a whole number, it could be 1.75 or 2.5 or any value you find useful in your optimization.

You can vary two inputs used in your Bollinger Bands, the length or duration, which could be anywhere from a couple of days to 200 days, and the number of standard deviations in the Bollinger Band which could vary anywhere from say 0.5 – 5.0 depending on the purpose.

The higher the standard deviation number, the wider the bands. The lower the standard deviation number, the tighter the bands are, more closely wrapped around the simple moving average.

Bollinger Band Trading

There are several common approaches to Bollinger Band trading that you should consider. These are:

  • Trend Trading with Bollinger bands
  • Mean reversion with Bollinger Bands
  • Bollinger Band Squeeze Trading

Trend Trading with Bollinger Bands

The first Bollinger Band trading strategy is trend trading. On the chart below, you’ll see that Afterpay, the stock has been trending really strongly since April 2020. The chart below is a 20-day Bollinger Band with a two standard deviation multiple.

The ultimate guide to bollinger bands - trend trading with bollinger bands

Notice that early in this move the price closed above the top Bollinger Band (this is a sign of strength and is often a good entry signal) and then during the whole uptrend the price was above or very close to the top Bollinger Band.

For trend following or trend trading with Bollinger Bands, what you’re looking for is a new uptrend which is signalled by a breakout, with the price closing above the upper band. This signals that the price is strong and moving up.

With trend trading, you’re getting in on a breakout or a new trend expecting that the trend will continue and a breakout above the upper band is a good indication of that happening.

You can also use Bollinger Bands for your trend following exit. Using the same stock as an example, we can see other periods where it was trending up and then it started trending down and actually touched or broke below the lower Bollinger Band. This indicates the trend is either over or will is taking a break and likely to move sideways for a while as shown in the Bollinger Band chart below:

The ultimate guide to bollinger bands - Lower band indicates trend weakness

So you can use a breakout above the upper Bollinger Band for your entry, you could use a breakout below the lower band for your exit or you could just exit below a simple moving average or an exponential moving average or a trailing stop or something like that. The chart below illustrates how this can work exceptionally well to catch strong trends:

The ultimate guide to bollinger bands - trend trading system example

A Bollinger Band breakout entry combined with a typical trend-following exit (a percentage trailing stop, an ATR based trailing stop, a close below a long-term moving average like a 150-day moving average, or even a breakout below the bottom band) can make a really solid trend trading strategy.

Mean Reversion Trading with Bollinger Bands

You can also use Bollinger Bands in mean reversion trading systems and strategies. What you’re doing with mean reversion is fading the short term move (trading in the opposite direction). If the price has spiked down, you’re going to buy it, expecting for it to bounce up, reverting back to the mean. If the price has really spiked up, you’re going to short it, expecting it to bounce down so you can cover it at a profit, again reversion to the mean.

In mean reversion, you’re looking to fade the breakout or fade the price move above the top Bollinger Band. If there’s no real trend in the stock but short-term the price has jumped up and it’s just crossed above the upper band, that would be a good mean reversion trade to get short in anticipation of covering either below the moving average or towards the lower band.

The ultimate guide to bollinger bands - mean erversion trading system example

You might look to go long when the price closes or crosses below the bottom Bollinger Band in anticipation of this rally and exit long when the price crosses above the moving average or when it approaches the upper Bollinger Band.

However in mean reversion trading systems, you’ve got to make sure that it’s not a new trend. You don’t want to short a breakout when a strong trend is forming in the direction of the breakout because you could end up with the position moving a long way against you.

With these ideas, you don’t want to just trade these on blind faith, you should  take these signal ideas, put them into your backtesting software like AmiBroker, and backtest them as a complete trading system and see if they’ve actually got an edge in the markets.  These are good ideas but you need to test them in your markets and see if they actually can generate the level of profit that you want. You should never trade any indicator on blind faith, you must backtest it and see if it actually works.

Bollinger Band Squeeze

Another approach is called Bollinger Band squeeze. One good example to explain this is Bollinger Bands expand when volatility expands and contract when the volatility shrinks, and when the Bollinger Bands squeeze right together in and around the moving average as shown in the chart below, it can be a good entry to buy in anticipation of a breakout. In line with this, you’re buying a Bollinger Band squeeze in anticipation of a breakout and so you want to trade in the direction of the primary trend.

The ultimate guide to bollinger bands - bollinger band squeeze example

If there’s a Bollinger Band squeeze in an uptrend, you’re not going short because the probability is lying to breakout to the upside. Instead you’re using the primary trend and the squeezing together of the bands to position yourself in anticipation of getting a breakout like this. If you do that, you’re getting a very low-risk entry because you’re entering when volatility is low.

You can place your stop-loss pretty tight underneath your entry point and if the price starts to turn down, then you get out really quick without a large loss but if you do get a breakout (that often comes after a Bollinger Band squeeze), then you can ride this upswing for a while and exit at a profit later on either with a profit target or a close below a short-term moving average or with a long term moving average / trailing stop loss for larger profits as described above in the Bollinger Band trend following system explanation.

A Bollinger Band squeeze is another good way to use this excellent technical indicator in a trading system.

Just as a quick reminder – You should never use any technical indicator without backtesting it first. Use trading software like AmiBroker to put your rules, entries, exits, and position sizing into your software. Backtest it over 20-30 years of data over thousands of stocks and make sure the strategy actually has a real edge in your markets  and your entry and exit rules work effectively together.

Bollinger Band Settings

In this article we have mentioned two different types of settings in the Bollinger Bands – The Period (number of bars) used in the calculation of the movig average and the standard deviation, and the width of the bands, which is the multiple of standard deviation used to calculate the distance from the moving average for the upper and lower band.

In AmiBroker,  just edit the settings on the chart by right clicking on the chart and selecting parameters. You can see that we’ve got the periods which is the number of days, and the width which is the standard deviation multiple.

The ultimate guide to bollinger bands - adjusting bollinger band parameters in Amibroker charts

At the moment we’ve got a 20-bar (20-day) Bollinger Band with a two-standard deviation band width. The most common settings are 1, 2 or 3 standard deviations (there is no need for this to be a whole number). You could use 1.5, 1.25, or 2.5 depending on what you are trying to achieve with your Bollinger Band trading system.

The idea with any technical indicator setting or parameter value is backtest it and see which one is best. You can optimize your parameter values very easily using a software like AmiBroker and see which Bollinger Band settings work best.

Bollinger Bands Length

The Bollinger Band width determines the strictness of your entry or exit. If you want to have a stricter entry, then you use a larger standard deviation multiple 2 – 4 standard deviations. If you want to have a very easy signal that gets you in or out quickly and easily without much movement, then you’ll want to use a narrower standard deviation multiple.

One standard deviation would be quite an easy entry and you can see this many times on any chart where the price breaks above the one standard deviation upper band, and many times where the price breaks below the one standard deviation lower Bollinger Band.

If you want to have a more difficult or a stricter entry, use wider bands, such as 2-4 times the standard deviation over the last 20 days. For the price to get above the upper Bollinger Band or below the lower band, it has to move much more forcefully, much more quickly.

Bollinger Bands Length

Let’s now have a look at what happens with the number of periods.

If you change the period from 20 bars to 100 bars (just to take an extreme example) the Bollinger Band uses as more bars of data to calculate both the moving average and the standard deviation. What we’re going to see is a broader standard deviation and quite a different shape of Bollinger Band – they are much smoother and slower moving for the longer periods because the standard deviation is more stable the more data you use to calculate it.

The ultimate guide to bollinger bands - impact of bollinger band periods

In the top pane of the chart above there is a 20 bar, 2 standard deviation Bollinger Band and in the bottom pane there is a 100-bar, 2 standard deviation Bollinger Band. As you can see, the longer the period used, the slower the Bollinger Bands move.

It takes a much bigger move in the stock price to get above the upper band or below the lower band when you are using a 100 bar period compared to the 20 bar period. So if you want a longer term trading system that takes fewer entries and exits more slowly, then you would use a longer period to calculate your Bollinger Bands.

The longer the number of periods in the Bollinger Band calculation, the smoother the bands are and the slower it is to react. You can tune both the width and the duration of the Bollinger Bands to meet your needs. If you want a longer-term system, you use a larger number of periods. If you want a system that trades less often, use a wider Bollinger Band, and you’re going to get higher average profit per trade, but much fewer trades. If you want a system that trades much more often because you need more activity, then have a narrow Bollinger Band, and you can get more signals, but those signals won’t necessarily be as good.

Creative ways to use Bollinger Bands

There are three creative ways to use Bollinger Band, the %B for mean reversion systems, as a trend filter, which is part of your trend trading system, or as the stop-loss level, as an alternative to an average true range or initial stop loss.

The Bollinger Band %B Oscillator

The %B Oscillator converts Bollinger Bands into an oscillator. The way it works is it takes the upper band and assigns it a value of 100 and the lower band and assigns it a value of zero. Every day the price is somewhere usually between those upper and lower bands.

If the price is right in the middle, the %B will be 50, 50% because it’s halfway. If the price rather is right at the bottom Bollinger Band, then the %B will be zero. If the price is right at the top band, the %B will be 100. If it’s just above the top band, then the %B will be above 100.

The reason you might use this indicator is in mean reversion trading systems, often an oscillator style indicator is much more natural to think about and use. So rather than plotting the Bollinger Bands on the chart, you put the %B as an indicator in a pane below the chart, and you can see the oversold and the other-bought points in that chart. Changing the Bollinger Bands to an oscillator by using %B is one interesting and creative approach.

Bollinger Bands as a Trend Filter

Another interesting or useful way you can use Bollinger Bands is as a trend filter. As a trend filter, the stock is trending strongly whenever price is above the upper band. Using this as a filter you would use a fairly long period to calculate the bands, but a narrow width for the bands.

For example, a 100 bar, 1 standard deviation Bollinger Band could be used as quite an effective trend filter because when the stock is trending up it will generally have a closing price above the upper band with these settings.

You can use the upper band as a threshold to tell you when the trend is really strong. This is useful as part of a holistic trend trading system. You could use this as the trend filter and then time your exact entry based on a shorter term indicator based signal, or candlestick pattern entry.

Bollinger Bands as a Stop Loss

You can also use Bollinger Bands to set your initial stop-loss level when you place a trade. You do this by calculating the lower band on the day of entry and placing your stop at that level. Setting your stop loss level this way is really powerful because your stop-loss is linked to the volatility of the stock. A very wildly volatile stock will have a wide stop-loss because the standard deviation is high. A very quiet, calm stock will have a tighter stop-loss because the standard deviation is lower.

Using Bollinger Bands for your stop loss is similar to using average true range for your stop-loss because it’s linked to the volatility of the stock. If that stock gets more volatile over time and you took a trade later on when it’s more volatile, the stop-loss is going to be wider. The key to a good stop-loss is it’s adaptable, adjustable to the volatility of the instrument you’re trading at the time.

Conclusion On Using Bollinger Bands in Your Trading

In this article, we’ve covered what are Bollinger Bands, the formula to calculate Bollinger Bands, Bollinger Band trading, which you can do in trend trading system and mean reversion systems. You can also use Bollinger Band squeezes to trade in anticipation of breakout. We’ve talked about the Bollinger Band settings, which include the length and the multiple or width of the Bands and how you can use those to fine tune this powerful technical trading indicator to do what you need.

The key above all else is to take these ideas and backtest them for yourself in your stock trading systems and use a software like AmiBroker to put your ideas in, backtest them over 10 or 20 years of history over thousands of stocks, because that’s what’s going to give you the confidence that this rule has an edge in your market.

Don’t fall victim to the typical trap of seeing a couple of well-chosen examples and just trading it because that’s not going to give you enough confidence, and it may not be as profitable as you think. Systematic trading and backtesting your idea is the way to build that confidence.

If you want to learn how to trade systematically, how to launch your systematic trading career in just six weeks or less, click the link below and join System Trader Launch Pad, which is Enlightened Stock Trading’s ultra effective program to introduce you to systematic trading,  learn how to backtest, and show you how to use a profitable trading system – All in just six weeks or less.

It doesn’t matter whether you’re a new trader or an experienced technical analyst, this is the way to start trading systematically, to build confidence in your trading by backtesting your ideas and making sure that they are profitable before risking a single dollar in the market. So click this link to  find out about System Trader Launch Pad, and I hope to see you inside the program.