How to Create a Candlestick Chart

Table of Contents

What is a Candlestick Chart

Japanese Candlestick charts are used to track price movements and help making decisions on purchasing stock. Each candlestick may show a stock price variation within a period of one day, month, quarter or year.

Each stick represents the high to low during the period. The bar is delimited by the opening and closing price.

Remark the high is always on top, but open and close may switch places. With close on top, we have a rising price, and we may use the up color. With close at the bottom, the falling price may be displayed with the down color.

Steps to Create a Candlestick Chart

Start Visual Xtractor or Data Xtractor. Connect to a database. Create or design a SQL query. Run the query and check the results.

  1. Display and enable the Chart query builder.
  2. For your opening and closing price values, use the Stock ChartsStock Open and/or Stock Close selections. You may skip one of them and set the Auto Open or Close option. You may assign each of them once only.
  3. For your low and high price values, use the Stock ChartsStock Low and/or Stock High selections. You may skip both, and use them once only.
  4. In the Stock Chart Options toolbar button, make sure the Candlestick is selected.
  5. Select one datetime column as chart Label. When omitted, a series of 1, 2, 3 etc will be automatically generated for the horizontal X time axis.
  6. You may also add an Area chart at the bottom with Volume values.
  7. Or you may add a Bollinger Band chart (as a Range Spline Area) in the background.

Candlestick Chart Demo Query

This is a great alternative to learn about and play with this type of chart, if you don’t want to create it from scratch.

Candlestick Chart

Look for the ready-to-use single-series Candlestick Chart generated query under the Queries > Demo Queries > Charts > Stock Charts folder. Click on the “add demo queries” command link, if not already there.

The generated demo queries must work for any database, with no restriction. They use constant values generated on-the-fly and your database SQL engine, but do not depend on data from your tables, and never alter your database in any way.

Candlestick Chart with no Open or Close

While the opening price of one day is usually the same as the closing price of the previous day, you may omit either Open or Close, and check the Auto Open or Close toolbar option to automatically determine the missing value.

For instance, the Candlestick chart below has the Close values determined from the Open values, and it looks almost identical to the previous complete Candlestick chart.

Candlestick Chart with no Close

The Auto-Fill Open-Close Chart demo query shows a Candlestick or OHLC stock chart with either Open or Close missing.

Did You KnowA chart type with both Open and Close missing, with only Low and High, is also possible, but this is no longer a Candlestick chart.

The resulting chart is actually called High-Low (or HiLo) chart and described separately, as it is more generic.

Candlestick Chart with no Low and/or High

When Low and/or High are omitted, we look at a Candle chart, i.e. a Candlestick chart with no sticks, or just partial sticks. Low and High values are not essential to draw a Candlestick chart, but other charting libraries always expect them, we don’t.

Candle Chart

The Candle Chart demo query shows a Candlestick stock chart with no Low and High.

Candlestick Chart with Volume

It is customary to sometimes show below a stock chart a synchronized Volume Area chart. By default, it will be semi-transparent:

Candlestick Chart with Volume

The Stock with Volume demo query shows a Candlestick or OHLC stock chart with a Volume Area chart at the bottom.

Candlestick Chart with Bollinger Band

On a stock chart you may also add a synchronized Bollinger Band chart in the background. It will be semi-transparent Range Spline Area and assigned to an empty or newly added last column.

Candlestick with Bollinger Bands

The Stock with Bollinger Band demo query shows a Candlestick or OHLC stock chart with a Bollinger Band chart on the background.

Customize your Candlestick Chart

The chart toolbar at the bottom has many options you may change with one single click, to alter the graph. Here is just an example of what you can further do with this type of chart:

  1. Select a different drawing style (such as Tubular).
  2. Remove the up-and-down colors, to make the graph monochrome.
  3. Show data labels, hide Y axis labels and show staggered X axis labels.
  4. You may also leave no gaps between the candles, or show them as thin lollipop sticks

Custom Candlestick Chart


  • Creating Candlestick charts in Data Xtractor or Visual Xtractor is fast, intuitive and versatile: set your price/stock data columns as Stock Open, Stock Close, Stock Low and Stock High (not all columns required!), and one optional datetime column as Label.
  • Make sure your stock chart is rendered as Candlesticks, and not OHLC.
  • Add also a Volume Area chart at the bottom, or a Bollinger Band in the background.
  • Render the chart with optional Low and/or High values, as Candle chart.
  • Use previous Open/Close values to automatically determine the next Close/Open values, when one of them is not present.
  • Many builtin powerful features of these chart type are common to most other charts: filtering series through the legend items, interactivity, monochrome or grayscale colors etc.
  • Switch to another builtin chart theme, or customize your own, for any possible color or other styles.