Momentum

eSignal EFS 2

Momentum

Top  Previous  Next

 

mom( length [, source | sym() | inv()] [, barIndex] )

 

Calculated by subtracting a price for a given interval in the past from the current price. You determine how many intervals to go back for the price that is subtracted. The momentum study is an indication of overbuying or overselling. A positive value indicates overbuying, while a negative value indicates overselling.

 

Parameters

 

length

period to use for the calculation

 

source

optional. input series for the study

default: close

sym()

optional. specify a symbol to use

default: current symbol

inv()

optional. specify a bar interval to use

default: current interval

barIndex

optional. bar index of value to retrieve

default: current value

 

To Create a Series

 

var myStudy = null;

var bInit = false;

 

function main() {

var myVar;

 

       if ( bInit == false ) {

               

               myStudy = mom( 20 );

               bInit = true;

 

       }

 

       //retrieve the current value

       myVar = myStudy.getValue(0);

 

       return( myVar );

 

}

 

To Retrieve a Single Value

 

function main() {

 

       ...

       ...

       myVar = mom( 14 );

 

       //do something with the value in myVar

 

}

 

Calling Examples

 

       //create a study that uses IBM as the symbol along with whatever bar

       //interval you are using in the chart where the script is loaded

       myStudy = mom( 15, sym( "IBM") );

 

       //create a study that uses the 15-min bar interval, regardless of the bar 

       //interval of the chart in which the script is loaded

       myStudy = mom( 15, inv(15) );

 

       //create a study that uses the Daily bar interval, regardless of the bar 

       //interval of the chart in which the script is loaded

       myStudy = mom( 5, inv("D") );

 

       //create a study that will be based on MSFT 30-min bars, regardless of

       //the symbol/bar interval of the chart in which the script is loaded

       myStudy = mom( 14, sym( "MSFT,30" ) );

 

       //create a study that will be based on the high.

       myStudy = mom( 15, high() );

 

       //create a study that will be based on the close, using 15-min bars, regardless of 

       //the bar interval of the chart in which the script is loaded

       myStudy = mom( 20, close( inv(15) ) );

 

 

offsetSeries()