GetStochStudy

ICE Data Services -

GetStochStudy() Advanced GET Study Functions


Creates object, which allows to get values of indicator Advanced GET Stochastic in EFS scripts. 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. The third returns of Stochastic is False Bar. If a False Bar appears over the Stochastics signal, you should just ignore the Stochastics signal as if it never existed.

Syntax

GetStochStudy( nLength , nMavg1 , nMavg2 )

 

Parameters

Parameter: Description: Default:
nLength The number of bars used to calculate the %K.

 

n/a
nMavg1 The period of the moving average that is used to smooth %K.

 

n/a
nMavg2 The period of the moving average that is applied to %K to find %D.

 

n/a

 

Member(s)

Syntax: Returned value:
GetStochStudy.STOCHK Returns the %K series

 

GetStochStudy.STOCHD Returns the %D series

 

GetStochStudy.MARKS Returns the False Bar values. It can be equal 1 or 2. 1 - false overbought signal, 2 - false oversold signal.

 

 

Notes

Only available in versions 7.9 or later.

 

Code Example

Advanced GET Stochastic Indicator:
var fpArray = new Array();
function preMain() {
  askForInput();
  setDefaultBarFgColor(Color.blue, 0);
  setDefaultBarFgColor(Color.red, 1);
  setDefaultBarFgColor(Color.grey, 2);
  setShowSeries(false, 2);
  setStudyTitle("AGET Stochastic");
  setCursorLabelName("%K", 0);
  setCursorLabelName("%D", 1);
  setCursorLabelName("MARKS", 2);
  var x = 0;
  fpArray[x] = new FunctionParameter("nLength", FunctionParameter.NUMBER);
  with (fpArray[x++]) {
    setName("Length");
    setLowerLimit(1);
    setDefault(14);
  }
  fpArray[x] = new FunctionParameter("nMavg1", FunctionParameter.NUMBER);
  with (fpArray[x++]) {
    setName("MAvg1");
    setLowerLimit(1);
    setDefault(3);
  }
  fpArray[x] = new FunctionParameter("nMavg2", FunctionParameter.NUMBER);
  with (fpArray[x++]) {
    setName("MAvg2");
    setLowerLimit(1);
    setDefault(3);
  }
}
var vStoch = null;
var i = 0;
function main(nLength, nMavg1, nMavg2) {
  if (vStoch == null) vStoch = new GetStochStudy(nLength, nMavg1, nMavg2);
  var curMARKS = vStoch.getValue(GetStochStudy.MARKS);
  i++;
  if (curMARKS == 2)
    drawShapeRelative(
      0,
      BottomRow1,
      Shape.SQUARE,
      null,
      Color.grey,
      Shape.PRESET,
      "fig" + i
    );
  if (curMARKS == 1)
    drawShapeRelative(
      0,
      TopRow1,
      Shape.SQUARE,
      null,
      Color.grey,
      Shape.PRESET,
      "fig" + i
    );
  return new Array(
    vStoch.getValue(GetStochStudy.STOCHK),
    vStoch.getValue(GetStochStudy.STOCHD),
    vStoch.getValue(GetStochStudy.MARKS)
  );
}

 

See Also

Advanced GET Studies