MIP Logo

Build candlestick chart in Tableau I: fixed interval

This post was originally published on The Data School blog between 2018 and July 2025, before our program was renamed to MIP’s Analytics Career Accelerator. References throughout this article to “The Data School” or “DS” all refer to what is now MIP’s Analytics Career Accelerator. The program, its people, and its commitment to launching outstanding analytics careers remain the same – just under a new name.

If you are having trouble viewing this article, please report it here. 

Previously, I introduced in my blog how to download stock market data from the Yahoo Finance API. This time I want to use the download data to build a candlestick chart in Tableau. I will use the SPY ETF data I downloaded in the previous blog to build the chart.

In this blog, we will build a fixed interval candlestick chart. The fixed interval is the interval between the opening and closing prices provided by the data set. The fixed interval of the SPY data we downloaded is one day. I plan to write another blog post to build an adjustable interval candlestick chart later on.

Step 1:

We first need to create two calculated fields, called “Spread Open to Close” and “Spread Low to High”, which determine the length of the candles.

Then we drag the Date field to the Columns shelf and expand it to the day level. Drag the Open price and Low price to the Rows shelf. We will get two graphs as follows:

Step 2:

Now we will switch both charts to the Gantt bar chart. Drag “Spread Open to Close” to the size card of the SUM(Open) Marks card, and drag “Spread Low to High” to the size card of the SUM(Low) Marks card. At the moment, the bars of the charts are almost invisible. We can right-click on the vertical axis, click “Edit Axis…” and uncheck “Include zero” for both charts to dynamically adjust the range of the axes.

Step 3:

Before making a dual-axis, we first color the bar chart according to the candlestick chart convention, where the red bar represents the price drop in the interval, and the green bar represents the price rise in the interval. To do this, we drag “Spread Open to Close” onto the color cards of the two charts. Change the color to Red-Green Diverging, tick the Stepped Color option, and change the steps to 2.

After coloring the bars, we stack the two charts by clicking on a measure on the Rows shelf and selecting “Dual Axis”. Right-click on the secondary axis on the right and select Synchronize Axis to align the axes. Then we can hide the secondary axis. Finally, adjust the bar size of the SUM(low) chart to be much smaller than the SUM(Open) chart, and we will have a beautiful candlestick chart!

Share this post