Chop

eSignal EFS 2

Chop

Top  Previous  Next

 

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

 

Choppiness is a function of market direction. A market that is trending has a low choppiness number while a trend less market has a high choppiness number. The Choppiness Index ranges between 0 and 100, the higher the index the choppier the price action is and the lower the index the more trending the price action.

 

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

               bInit = true;

 

       }

 

       //retrieve the current value

       myVar = myStudy.getValue(0);

 

       return( myVar );

 

}

 

To Retrieve a Single Value

 

function main() {

 

       ...

       ...

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

 

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

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

 

 

offsetSeries()