Commodity Channel Index

eSignal EFS 2

Commodity Channel Index

Top  Previous  Next

 

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

 

The Commodity Channel Index (CCI) is a price momentum indicator that measure the price excursions from the mean price as a statistical variation.  It is used to detect the beginnings and endings of trends.

 

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 = cci( 12 );

               bInit = true;

 

       }

 

       //retrieve the current value

       myVar = myStudy.getValue(0);

 

       return( myVar );

 

}

 

To Retrieve a Single Value

 

function main() {

 

       ...

       ...

       myVar = cci( 7 );

 

       //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 = cci( 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 = cci( 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 = cci( 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 = cci( 14, sym( "MSFT,30" ) );

 

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

       myStudy = cci( 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 = cci( 20, close( inv(15) ) );

 

 

offsetSeries()