Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

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 is specified as a character vector. 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. Date is specified as a serial date number or datetime array.

Dateform

(Optional) Date character vector 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 character vector format used as the x-axis tick labels.

Examples

collapse all

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');

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

load disney;
dates=datetime(2015,1,1:21);
candle(dis_HIGH(end-20:end), dis_LOW(end-20:end), dis_CLOSE(end-20:end),...
dis_OPEN(end-20:end), 'b',dates','dd-mmm');

Related Examples

Introduced before R2006a

Was this topic helpful?