LJ
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);
is the sample code in the documentation and does indeed give the current values, whereas this
if(iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,1)>iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,1)) return(0);
will give the vales of the last closed bar (note the Shift value is now 1 not 0)
Good Luck
-BB-
BarrowBoy:
LJ
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);
is the sample code in the documentation and does indeed give the current values, whereas this
if(iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,1)>iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_SIGNAL,1)) return(0);
will give the vales of the last closed bar (note the Shift value is now 1 not 0)
Good Luck
-BB-
Thanks BarrowBoy,
I will try that out...

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, I just started to programming in MQL and I wished to write a EA to detect divergence of stochastics against the price.
I would like to open a trade when the stochastic main crosses below the signal line while the price is making higher high on close of the current bar.
I tried but it seems that iStochastic only get the current value and not the value when the bar closes.
I appreciate anyone who can lift me out of my inability to get this correctly done.
Thank you and best regards.