This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Bollinger band chart

bolling will be removed in a future release. Use bollinger instead.


[Movavgv,UpperBand,LowerBand] = bolling(Asset,Samples,Alpha,Width)



Vector of asset data.


Number of samples to use in computing the moving average.


(Optional) Exponent used to compute the element weights of the moving average. Default = 0 (simple moving average).


(Optional) Number of standard deviations to include in the envelope. A multiplicative factor specifying how tight the bands should be around the simple moving average. Default = 2.


bolling(Asset,Samples,Alpha,Width) plots Bollinger bands for given Asset data. This form of the function does not return any data.

[Movavgv,UpperBand,LowerBand] = bolling(Asset,Samples,Alpha,Width) returns Movavgv with the moving average of the Asset data, UpperBand with the upper band data, and LowerBand with the lower band data. This form of the function does not plot any data.


The standard deviations are normalized by N-1, where N = the sequence length.


If Asset is a column vector of closing stock prices

bolling(Asset, 20, 1)

plots linear 20-day moving average Bollinger bands based on the stock prices.

[Movavgv, UpperBand, LowerBand] = bolling(Asset, 20, 1)

returns Movavgv, UpperBand, and LowerBand as vectors containing the moving average, upper band, and lower band data, without plotting the data.

Introduced before R2006a