candle

Candlestick chart

candle is updated to accept data input as a matrix, timetable, or table.

Description

example

candle(Data) plots a candlestick chart from a series of opening, high, low, and closing prices of a security. If the closing price is greater than the opening price, the body (the region between the open and close price) is unfilled; otherwise the body is filled.

example

candle(Data,Color) adds an optional argument for Color.

example

h = candle(ax___) adds an optional argument for ax.

Examples

collapse all

Load the file SimulatedStock.mat, which provides a timetable (TMW) for financial data for TMW stock. This is a candlestick chart with blue candles, for the most recent 21 days in SimulatedStock.mat.

load SimulatedStock.mat;
candle(TMW(end-20:end,:),'b');
title('Candlestick chart for TMW')

Input Arguments

collapse all

Data for opening, high, low, and closing prices, specified as a matrix, table, or timetable. For matrix input, Data is an M-by-4 matrix of opening, high, low, and closing prices stored in the corresponding columns. Timetables and tables with M rows must contain variables named 'Open', 'High', 'Low', and 'Close' (case insensitive).

Data Types: double | table | timetable

Three element color vector, specified as a [R G B] color vector or a string specifying the color name. The default color differs depending on the background color of the figure window. For more information, see colorspec.

Data Types: double | string

(Optional) Valid axis object, specified as an axes object. The candle plot is created in the axes specified by ax instead of in the current axes (ax = gca). The option ax can precede any of the input argument combinations.

Data Types: object

Output Arguments

collapse all

Graphic handle of the figure, returned as a handle object.

Introduced before R2006a