sometimes getting wrong values from indicator using different period
I dont think wrong value,
show the value on chart as comment("\n\n........
then open chart m5, then compare the value
The value didn't match the one on the chart.
Also I can replicate it easily, at least when it comes to 0 values. I open a new chart. Attach my EA. My EA makes a call to iStochastic or iRSI with period 5 every tick (the chart has a period higher than 5). The first time always return 0 on all bars, at least for shifts 0,1,2 which are the ones I've tried. Any ticks after this return the proper values, or at least not 0 because that would show up in my log.
As the title says. Like in an EA attached to a 1H chart I have this code:
iStochastic(NULL,5,14,3,3,MODE_SMA,0,MODE_MAIN,0);
And a similar one for iRSI. Both gave me wrong values. Not even close to the real one. I had no 5 minute chart open but that shouldn't be necessary? I do such calls all the time in another EA without having the corresponding chart open and usually there is no problem.
What can be wrong?