Documentation Center

  • Trial Software
  • Product Updates

candle

Candlestick chart

Syntax

candle(HighPrices, LowPrices, ClosePrices, OpenPrices)
candle(HighPrices, LowPrices, ClosePrices, OpenPrices,
Color, Dates, Dateform)

Arguments

HighPrices

High prices for a security. A column vector.

LowPrices

Low prices for a security. A column vector.

ClosePrices

Closing prices for a security. A column vector.

OpenPrices

Opening prices for a security. A column vector.

Color

(Optional) Candlestick color. A string. MATLAB® software supplies a default color if none is specified. The default color differs depending on the background color of the figure window. See ColorSpec in the MATLAB documentation for color names.

Dates

(Optional) Column vector of dates for user specified X-axis tick labels.

Dateform

(Optional) Date string format used as the x-axis tick labels. (See datetick in the MATLAB documentation.) You can specify a dateform only when tsobj does not contain time-of-day data. If tsobj contains time-of-day data, dateform is restricted to 'dd-mmm-yyyy HH:MM'.

Description

candle(HighPrices, LowPrices, ClosePrices, OpenPrices) plots a candlestick chart given column vectors with the high, low, closing, and opening prices of a security.

If the closing price is greater than the opening price, the body (the region between the opening and closing price) is unfilled.

If the opening price is greater than the closing price, the body is filled.

candle(HighPrices, LowPrices, ClosePrices, OpenPrices, Color, Dates, Dateform) plots a candlestick chart given column vectors with the high, low, closing, and opening prices of a security. In addition, the optional arguments Color, Dates, and Dateform specify the color of the candle box and the date string format used as the x-axis tick labels.

Examples

expand all

Create a Candlestick Chart

This example shows how to create a candlestick chart, with blue candles, for the most recent 21 days in disney.mat.

load disney;
candle(dis_HIGH(end-20:end), dis_LOW(end-20:end), dis_CLOSE(end-20:end),...
dis_OPEN(end-20:end), 'b');

See Also

| | | | |

Was this topic helpful?