ADX/DM |
Top Previous Next |
adx( length, smoothing [, sym() | inv()] [, barIndex] ) pdi( length, smoothing [, sym() | inv()] [, barIndex] ) ndi( length, smoothing [, sym() | inv()] [, barIndex] )
ADX indicates the strength of the overall trend. Typically readings below 20-25 indicate a weak trend. +DI and -DI show the strength of the up trend (+DI) and the strength of the downtrend (-DI) respectively.
Parameters
To Create a Series
var myStudy1 = null; var myStudy2 = null; var myStudy3 = null; var bInit = false;
function main() { var myVar1; var myVar2; var myVar3;
if ( bInit == false ) {
myStudy1 = adx( 10, 5 ); myStudy2 = pdi( 10, 12 ); myStudy3 = ndi( 10, 12 );
bInit = true;
}
//retrieve the current values myVar1 = myStudy1.getValue(0); myVar2 = myStudy2.getValue(0); myVar3 = myStudy3.getValue(0);
return new Array( myVar1, myVar2, myVar3 );
}
To Retrieve a Single Value
function main() {
... ... myVar = adx( 10, 5 );
//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 = adx( 10, 5, 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 = pdi( 12, 4, 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 = ndi( 10, 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 = adx( 21, 5, sym( "MSFT,30" ) );
|