<< backtest Financial module bsgreeks >>

Financial module >> Financial module > bollinger

bollinger

Given a moving average on the historical prices of an asset, the function creates two figures: in the first both the historical prices and the Bollinger bands (i.e. the moving average +/- "a" times the price standard deviation) are shown, in the second the so-called b-percentage is shown

SYNOPSIS

bollinger (prices, m, a)

Description

Function which creates two graphs: one with the Bollinger bands and one with the b-percentage index

Parameters

prices

column vector containing the historical prices of an asset

m

the lenght (in days if "prices" contains daily values) of the moving average which the bands are based on

a
factor which multiplies the standard deviation of historical prices for creating the bands around the mean

Example

First we generate 1000 log-normally distributed prices for an asset whose initial values is 25 euros. First step is the creation of 1000 normal random variables (with mean 0.1/250 and standard deviation 0.2/sqrt(250))

-->M=grand(1000,1,'nor',0.1/250,0.2/sqrt(250));

Then we create the prices

-->prices=exp(cumsum(M,1))*25

and apply the function with m=100 days and a=2.5 times:

-->bollinger(prices,100,2.5)

Authors

Francesco Menoncin - Brescia University - 2010

See Also


<< backtest Financial module bsgreeks >>