Download source files used in this article

Volatility analysis charts using Bollinger Bands are often used for trading decisions. Those who track stock price movements must be familiar with charts types shown below

Bollinger Bands are intervals drawn on price chart at standard deviation levels above and below the corresponding moving average.

Bollinger Bands consist of :

- an N-period moving average (MA)
- an upper band at K times an N-period standard deviation above the moving average (MA + Kσ)
- a lower band at K times an N-period standard deviation below the moving average (MA − Kσ)

Let us see how can we develop this chart using Tableau.

In this example, I connect to a database table which has daily price information of a stock. Simple data source – dimension as Date and measure as price.

Step one is to create a line chart, as shown below

Next we need to add 4 calculated files

- Moving Average
- Standard Deviation
- Upper Band
- Lower Band

Note: The above formulas have used 20 as N-period (look back period) and 2 as K-times to multiply since these are typical values used in real world. If we need to change these dynamically, we can consider using them as parameter fields.

Add ‘*Measure Names*‘ as filter to your sheet (select MA, LB and UB in the filter selection). Then drag and drop ‘*Measure Values’ to *Rows in the chart.

Choose ‘Dual Axis’ for Measure Values and synchronize the axis as next step.

We have the Bollinger Bands generated; however the color schemes are not intuitive. So lets modify that a little.

Here is the final chart

Download source files used in this article