| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Financial Toolbox |
| Contents | Index |
| Learn more about Financial Toolbox |
| On this page… |
|---|
The following toolbox financial charting functions plot financial data and produce presentation-quality figures quickly and easily.
Bollinger band chart | |
Time series Bollinger band | |
Candlestick chart | |
Time series candle plot | |
Point and figure chart | |
High, low, open, close chart | |
Time series High-Low plot | |
Leading and lagging moving averages chart |
These functions work with standard MATLAB functions that draw axes, control appearance, and add labels and titles. The toolbox also provides a comprehensive set of charting functions that work with financial time series objects. For lists of these, see Financial Data Charts and Financial Time Series Indicator.
Here are two plotting examples: a high-low-close chart of sample IBM® stock price data, and a Bollinger band chart of the same data. These examples load data from an external file (ibm.dat), then call the functions using subsets of the data. The MATLAB variable ibm , which is created by loading ibm.dat, is a six-column matrix where each row is a trading day's data and where columns 2, 3, and 4 contain the high, low, and closing prices, respectively.
First load the data and set up matrix dimensions. load and size are standard MATLAB functions.
load ibm.dat; [ro, co] = size(ibm);
Open a figure window for the chart. Use the Financial Toolbox highlow function to plot high, low, and close prices for the last 50 trading days in the data file.
figure; highlow(ibm(ro-50:ro,2),ibm(ro-50:ro,3),ibm(ro-50:ro,4),[],'b');
Add labels and title, and set axes with standard MATLAB functions. Use the Financial Toolbox dateaxis function to provide dates for the x-axis ticks.
xlabel('');
ylabel('Price ($)');
title('International Business Machines, 941231 - 950219');
axis([0 50 -inf inf]);
dateaxis('x',6,'31-Dec-1994')
MATLAB produces a figure like this. The plotted data and axes you see may differ. Viewed online, the high-low-close bars are blue.

The bolling function in Financial Toolbox software produces a Bollinger band chart using all the closing prices in the same IBM stock price matrix. A Bollinger band chart plots actual data along with three other bands of data. The upper band is two standard deviations above a moving average; the lower band is two standard deviations below that moving average; and the middle band is the moving average itself. This example uses a 15-day moving average.
Assuming the previous IBM data is still loaded, execute the function.
bolling(ibm(:,4), 15, 0);
Specify the axes, labels, and titles. Again, use dateaxis to add the x-axis dates.
axis([0 ro min(ibm(:,4)) max(ibm(:,4))]);
ylabel('Price ($)');
title(['International Business Machines']);
dateaxis('x', 6,'31-Dec-1994')

For help using MATLAB plotting functions, see Creating Plots in the MATLAB documentation. See the MATLAB documentation for details on the axis, title, xlabel, and ylabel functions.
![]() | Formatting Currency | Analyzing and Computing Cash Flows | ![]() |
View demos and recorded presentations led by industry experts.
Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |