AGet.stochastic()

ICE Data Services -

AGet.stochastic() Advanced GET Studies

Returns the series or values of the GET Stochastic study.
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. The False Bar is a proprietary Stochastics cycle study that can help weed out many of the false Stochastics signals. If a False Bar appears over the Stochastics signal, you should just ignore the Stochastics signal as if it never existed.
Syntax
AGet.stochastic( Length , %K , %D , ReturnSeries [, Series | sym() | inv() ][, BarIndex ] )
Parameters
Parameter: Description: Default:
Length An integer which represents the number of bars used to calculate the %K.

 

n/a %K An integer which represents the period of the moving average that is used to smooth %K.

 

n/a %D An integer which represents the period of the moving average that is applied to %K to find %D.

 

n/a ReturnSeries Allows to choose what series of the GET Stochastic study should be returned. To choose use the follwing constants:
STOCHASTIC_D = 0
STOCHASTIC_K = 1
STOCHASTIC_FALSEBAR = 2

 

n/a Series | sym() | inv() [Optional]  Series Object or function of sym() or inv() to determine symbol/interval source for the study.

 

Base sym/int BarIndex [Optional]  Bar index of series to retrieve.

 

n/a
Return Value(s)
Returns a Series Object when
nBarIndex is not specified. Series Object for the Falsebar series consists of the set of constants shown below.
Returns a single value when nBarIndex is specified. The function returns a single value of the Falsebar series from the set of constants shown below.
A set of constants for the Falsebar series:
NONE = 0UPPER = 1LOWER = -1
Notes
Only available in versions 11.8 or later.
Code Example
Creating and Using Series Example:
var bInit = false;var xSer1 = null;var xSer2 = null;var xSer3 = null;function main(){        if(bInit == false){        xSer1 = getSeries(AGet.stochastic(14, 3, 3, STOCHASTIC_K));        xSer2 = getSeries(AGet.stochastic(14, 3, 3, STOCHASTIC_D));        xSer3 = AGet.stochastic(14, 3, 3, STOCHASTIC_FALSEBAR);        bInit = true;    };    var nSer3 = xSer3.getValue(0);            if (nSer3 == UPPER)         drawShapeRelative(0,TopRow1,Shape.SQUARE,null,Color.RGB(0x7D,0x7D,0x7D),        Shape.CENTER|Shape.PRESET,"UP " + getCurrentBarCount());        if (nSer3 == LOWER)        drawShapeRelative(0,BottomRow1,Shape.SQUARE,null,Color.RGB(0x7D,0x7D,0x7D),        Shape.CENTER|Shape.PRESET,"DOWN " + getCurrentBarCount());        return new Array (xSer1,xSer2);} 
See Also
Advanced GET Study Functions
AGet.stochasticRSI()