Stochastic

eSignal EFS 2

Stochastic

Top  Previous  Next

 

stochK( kLength, kSmoothing, dLength [, source | sym() | inv()] [, barIndex] )

stochD( kLength, kSmoothing, dLength [, source | sym() | inv()] [, barIndex] )

 

The Stochastic is designed to indicate when the market is overbought or oversold. It is based on the premise that when a market's price increases, the closing prices tend to move toward the daily highs and, conversely, when a market's price decreases, the closing prices move toward the daily lows. A Stochastic displays two lines, %K and %D. %K is calculated by finding the highest and lowest point in a trading period and then finding where the current close is in relation to that trading range, %K is then smoothed with a moving average. %D is a moving average of %K.

 

Parameters

 

kLength

period for fastK calculation

 

kSmoothing

%K smoothing period

 

dLength

period for fastD calculation

 

source

optional. input series for the study

default: high, low and 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 interval

 

To Create a Series

 

var myStudy1 = null;

var myStudy2 = null;

var bInit = false;

 

function main() {

var myVar1;

var myVar2;

 

       if ( bInit == false ) {

               

               myStudy1 = stochK( 14, 1, 3 );

               myStudy2 = stochD( 14, 1, 3 );

 

               bInit = true;

 

       }

 

       //retrieve the current values

       myVar1 = myStudy1.getValue(0);

       myVar2 = myStudy2.getValue(0);

 

       return new Array( myVar1, myVar2 );

 

}

 

To Retrieve a Single Value

 

function main() {

 

       ...

       ...

       myVar = stochD( 14, 3, 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 = stochK( 1413, 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 = stochD( 1413, 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 = stochK( 533, 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 = stochK( 1425, sym( "MSFT,30" ) );

 

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

       myStudy = stochD( 1535, 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 = stochK( 1413, close( inv(15) ) );

 

 

offsetSeries()