Main Content

priceandvol

Price and Volume chart

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

The syntax for priceandvol has changed. Previously, when using table input, the first column of dates could be a datetime array, date character vectors, or serial date numbers, and you were required to have specific number of columns.

When using table input, the new syntax for priceandvol supports:

  • No need for time information. If you want to pass in date information, use timetable input.

  • No requirement of specific number of columns. However, you must provide valid column names. linebreak must contain columns named 'open', 'high', 'low', 'close', and 'volume' (case insensitive).

Description

example

priceandvol(Data) plots two charts from a series of opening, high, low, closing prices, and traded volume. Opening, high, low, and closing prices are on one axis and the volume series are on a second axis.

example

h = priceandvol(Data) adds a Graphic handle for the figure.

Examples

collapse all

Load the file SimulatedStock.mat, which provides a timetable (TMW) for financial data for TMW stock. This price and volume chart for the TMW stock contains the open, high, low, close, and volume for the most recent 21 days.

load SimulatedStock.mat
priceandvol(TMW(end-20:end,:));

Input Arguments

collapse all

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

Data Types: double | table | timetable

Output Arguments

collapse all

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

Version History

Introduced in R2008a

expand all