Average True Range

eSignal EFS 2

Average True Range

Top  Previous  Next

 

atr( length [, sym() | inv()] [, barIndex] )

 

The Average True Range (ATR) is a measure of volatility. It was introduced by Welles Wilder in his book New Concepts in Technical Trading Systems and has since been used as a component of many indicators and trading systems.

 

Wilder has found that the high ATR values often occur at market bottoms following a "panic" sell-off. Low ATR values are often found during extended sideways periods, such as those found at tops and after consolidation periods.

 

Parameters

 

length

period to use for the calculation

 

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

               bInit = true;

 

       }

 

       //retrieve the current value

       myVar = myStudy.getValue(0);

 

       return( myVar );

 

}

 

To Retrieve a Single Value

 

function main() {

 

       ...

       ...

       myVar = atr( 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 = atr( 50, 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 = atr( 10, 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 = atr( 10, 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 = atr( 15, sym( "MSFT,30" ) );

 

 

offsetSeries()