KNOWLEDGE BASE

Creating a Candlestick chart


Published: 06 Dec 2018
Last Modified Date: 15 Sep 2023

Question

How to create a candlestick chart to track stock data.

Environment

Tableau Desktop

Answer

Use a vertical line graph with a reference band per cell. The following directions utilize a sample data set which already has separate measures for the value of the stock at opening and closing, as well as the highest and lowest values that day.
  1. Right-click and drag Date to the Columns shelf
  2. In the Drop Field dialog, select Date (Discrete) with the blue # icon and click OK
    • Optional: right-click the x-axis in the view and select Rotate Label
  3. Drag High to Text on the Marks card
  4. Double-click Low in the data pane, which will automatically add Measure Names and Measure Values to the view
  5. Drag Measure Values from Text on the Marks card to the Rows shelf
  6. Remove Measure Names from the Rows shelf
  7. Right-click and drag Date to the Columns shelf
  8. In the Drop Field dialog, select MDY(Date) with the blue # icon and click OK
  9. Drag Open and Close to Detail on the Marks card
  10. Right-click the Value y-axis in the view and select Add Reference Line
  11. In the Add Reference Line, Band, or Box, do the following:
    • Select Band
    • For Scope, select Per Cell
    • For Band From Value:, select SUM(Open), Minimum
    • For Band From Label:, select None
    • For Band To Value:, select SUM(Close), Minimum
    • For Band To Label:, select None
    • Click OK
  12. Navigate to Format > Format Borders
  13. In the left-hand Format Border pane, do the following:
    • Under Column Divider, drag the Level slider all the way to the right
    • Under Column Divider, select a thick white line in the Pane dropdown menu
  14. Select Analysis > Create Calculated Field
  15. In the Calculated Field dialog box that opens, do the following:
    • Name the calculated field. In this example, the calculated field is named "Bullish/Bearish"
    • In the formula field, create a calculation similar to the following:
    IF SUM([Open]) > SUM([Close])
    THEN "Bearish"
    ELSE "Bullish"
    END
    
    • Click OK
  16. Drag Bullish/Bearish to Color on the Marks card
Did this article resolve the issue?