Main Content

Bollinger Chart

The bolling function in Financial Toolbox™ software produces a Bollinger band chart using all the closing prices in an 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. First, load the data using the ibm.dat data file and then execute the bolling function to plot the Bollinger bands.

load ibm.dat;
[ro, co] = size(ibm);
bolling(ibm(:,4), 15, 0);     
Warning: BOLLING will be removed in a future release. Use BOLLINGER instead.
axis([0 ro min(ibm(:,4)) max(ibm(:,4))]);
ylabel('Price ($)');
title(['International Business Machines']);
dateaxis('x', 6,'31-Dec-1994')

Figure contains an axes object. The axes object with title International Business Machines contains 4 objects of type line.

Specify the axes, labels, and titles. Use dateaxis to add the x-axis dates.

For help using MATLAB® plotting functions, see Create 2-D Line Plot in the MATLAB documentation. See the MATLAB documentation for details on the axis, title, xlabel, and ylabel functions.

See Also

| | | | | | | | | | | | | | | | | | | | | |

Related Topics