iStochastic Vs Stochastic Oscillator

 

Hi Seeking help from a kind soul out there.

I have pulled in the Stochastic indicator (Stochastic Oscillator) on my chart and I have written an EA for auto trading.

The function to calculate Stochastic is as follows:

double StochMain0 = iStochastic(NULL,0,10,10,3,MODE_EMA,0,MODE_MAIN,0)

double StochMain0T30 = iStochastic(NULL,30,10,10,3,MODE_EMA,0,MODE_MAIN,0)

I got the above from the MQ4 manual.

The interesting thing is, I see quite different result from the program and what is shown on the chart.

Quite often, when I see on the chart, the stochastic is already at the extreme on the chart, say above 90 or 100, but the stochastic value returned from the program is below 80. The parameters used are the same.

or the Stochastic on the chart is quite low,but the program returned is above 20.

I am more inclined to what I see on the chart. I wonder if there is anything wrong with the iStochastic function above?

Thank you for your kind contribution.

 

by the way,

I am using Version: 4.00  Build 840

 

You are using a shift of 0 (current bar), whose value for the indicator changes at every tick.

You can use this free tool I made about a year ago:

https://www.mql5.com/en/code/11464

Using this indicator, you may then compare the two outputs from the terminal and the indicator (Stochastic) by using the tool and opening the data window.

Indicator Tracer
Indicator Tracer
  • votes: 11
  • 2014.07.11
  • Enrico Lambino
  • www.mql5.com
Traces the output of indicators by buffer. Output can be changed on the chart by moving the VL left or right.