Documentation

priceandvol

Price and volume chart

Syntax

priceandvol(X)

Arguments

X

X can be a M-by-6 matrix or table. If X is M-by-6 matrix , the columns are date, open, high, low, close, and volume. If X is a table, the first column of the table is the date, and can be either serial date numbers, date character vectors, or datetime arrays. The other columns represent the same data as in the matrix version of the input.

Description

priceandvol(X) plots the asset data displaying the open, high, low, and closing prices on one axis and the volume on a second axis.

Examples

collapse all

Create a Price Volume Chart

This example shows how to create a price volume chart, given asset X as an M-by-6 matrix for date, open, high, low, close, and volume.

X = [...

733299.00         41.93         42.15         41.83         41.99   15045445.00;...
733300.00         42.09         42.24         41.76         42.14   15346658.00;...
733303.00         42.00         42.20         41.78         41.93    9034397.00;...
733304.00         41.82         42.16         41.70         41.98   14486275.00;...
733305.00         41.94         42.19         41.70         41.75   16389872.00;...
733306.00         42.00         42.57         41.50         41.61   20475208.00;...
733307.00         41.93         42.35         41.74         42.29   14833200.00;...
733310.00         42.01         42.70         42.01         42.19   18945176.00;...
733311.00         42.18         42.72         41.73         41.82   25188101.00;...
733312.00         42.57         42.57         41.33         41.93   22689878.00;...
733313.00         41.86         42.35         41.71         41.81   21084723.00;...
733314.00         41.70         41.90         41.04         41.37   27963619.00;...
733317.00         40.98         41.49         40.82         41.17   20385033.00;...
733318.00         41.50         42.15         41.21         42.02   27783775.00];

priceandvol(X)

Create a Price Volume Chart Using datetime Input

This example shows how to use datetime input to create a price volume chart, given asset X as an M-by-6 matrix for date, open, high, low, close, and volume.

X = [...
733299.00         41.93         42.15         41.83         41.99   15045445.00;...
733300.00         42.09         42.24         41.76         42.14   15346658.00;...
733303.00         42.00         42.20         41.78         41.93    9034397.00;...
733304.00         41.82         42.16         41.70         41.98   14486275.00;...
733305.00         41.94         42.19         41.70         41.75   16389872.00;...
733306.00         42.00         42.57         41.50         41.61   20475208.00;...
733307.00         41.93         42.35         41.74         42.29   14833200.00;...
733310.00         42.01         42.70         42.01         42.19   18945176.00;...
733311.00         42.18         42.72         41.73         41.82   25188101.00;...
733312.00         42.57         42.57         41.33         41.93   22689878.00;...
733313.00         41.86         42.35         41.71         41.81   21084723.00;...
733314.00         41.70         41.90         41.04         41.37   27963619.00;...
733317.00         40.98         41.49         40.82         41.17   20385033.00;...
733318.00         41.50         42.15         41.21         42.02   27783775.00];

dates = datetime(X(:,1),'ConvertFrom','datenum','Locale','en_US');
data = X(:,2:end);
t=[table(dates) array2table(data)];
priceandvol(t);

Related Examples

Introduced in R2008a

Was this topic helpful?