Page 1 of 1

array out of range in iHighest???

Posted: Sat Jan 07, 2017 11:59 pm
by fenky
dear support
got a strange result on High[iHighest(NULL,5,MODE_HIGH,30,0);] ---> The iHighest value is -1 on initialization
and High[] got error ---> array out of range ..
how can i result this issue , because iHighest is -1 . but i use backrest on mt4 built in ,it;s work well.

Re: array out of range in iHighest???

Posted: Sun Jan 08, 2017 10:51 pm
by tickstory
Hi Fenky,

You might want to refer to the MQL manual for answers to this. A brief look at the manual suggests -1 indicates an error which you will need to use GetLastError to determine what is causing it:

https://docs.mql4.com/series/ihighest

Hope this helps.

Re: array out of range in iHighest???

Posted: Mon Jan 09, 2017 2:03 am
by fenky
dear support:
i found solution in https://www.mql5.com/en/forum/127460
but i'm not use indicator , and i put code :
int counterd_bars=IndicatorCounted();
if(counterd_bars<0) return(-1);
and issue was result tks ^_^"

Re: array out of range in iHighest???

Posted: Mon Jan 09, 2017 11:25 am
by tickstory
Hi Fenky - thanks for letting us know how you solved it!

Regards.