NAME

GT::Indicators::SMA - Simple Moving Average


DESCRIPTION

A simple arithmetic moving average.

Parameters

Period (default 50)

The first argument is the period used to calculed the average.

Other data input

The second argument is optional. It can be used to specify an other stream of input data for the average instead of the close prices. This is usually an indicator (detailed via {I:MyIndic| <param>}) but it can also be "{I:Prices OPEN}", "{I:Prices HIGH}", "{I:Prices LOW}", "{I:Prices CLOSE}", "{I:Prices FIRST}" and "{I:Prices LAST}" and in which cases the corresponding prices serie will be used.

Creation

 GT::Indicators::SMA->new()
 GT::Indicators::SMA->new([20])

If you need a 30 days SMA of the opening prices you can write the following line:

 GT::Indicators::SMA->new([30, "{I:Prices OPEN}"])

A 10 days SMA of the RSI could be created with :

 GT::Indicators::SMA->new([10, "{I:RSI}"])