top of page

MQL4 Reference / Technical Indicators / iStochastic


Calculates the Stochastic Oscillator and returns its value.

double  iStochastic(
  string       symbol,           // symbol
  int          timeframe,        // timeframe
  int          Kperiod,          // K line period
  int          Dperiod,          // D line period
  int          slowing,          // slowing
  int          method,           // averaging method
  int          price_field,      // price (Low/High or Close/Close)
  int          mode,             // line index
  int          shift             // shift



         [in]  Symbol name on the data of which the indicator will be calculated. NULL means the current symbol.


         [in]  Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe.


         [in]  Period of the %K line.


         [in]  Period of the %D line.


         [in]  Slowing value.


         [in]  Moving Average method. It can be any of ENUM_MA_METHOD enumeration values.


         [in]  Price field parameter. Can be one of this values: 0 - Low/High or 1 - Close/Close.


         [in]  Indicator line index. It can be any of the Indicators line identifiers enumeration value (0 - MODE_MAIN, 1 - MODE_SIGNAL).


         [in]  Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

*Returned value

         Numerical value of the Stochastic Oscillator.



  if(iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,0)>iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,0)) return(0);

Page 1 of 3

bottom of page