Can an iCustom call trigger an out of range error?

 

Good morning,

I am having a little poltergeist again. I am working with another piece of code which needs the ZigZag indicator. So I created a handle and a buffer for it.

My code only contains an iCustom call to create the handle, there is no copybuffer being called yet nowhere.  At runtime, this error is thrown.

Any ideas? Thanks.

2013.08.24 12:35:32    ZigZag (EURUSD,D1)    array out of range in 'ZigZag.mq5' (192,32)


This is my code, inside the OnInit function:

ZZHandle = iCustom(_Symbol, 0, "Examples\\ZigZag", ZZ1, ZZBack, ZZDev);
if(ZZHandle == INVALID_HANDLE) return(INIT_FAILED);
This  error only happens when the ZZ1 variable is less than 6, and randomly.
 
PzTrading:

Good morning,

I am having a little poltergeist again. I am working with another piece of code which needs the ZigZag indicator. So I created a handle and a buffer for it.

My code only contains an iCustom call to create the handle, there is no copybuffer being called yet nowhere.  At runtime, this error is thrown.

Any ideas? Thanks.

2013.08.24 12:35:32    ZigZag (EURUSD,D1)    array out of range in 'ZigZag.mq5' (192,32)


This is my code, inside the OnInit function:

There is a bug in ZigZag indicator in this case, I have already reported it to Service Desk.

The problem arises when ExtDepth (1st) input parameter is lower than ExtBackstep (3rd) input parameter. I applied to following correction :

//--- set start position for calculations
   if(prev_calculated==0) limit=MathMax(ExtDepth, ExtBackstep);

in place of

//--- set start position for calculations
   if(prev_calculated==0) limit=ExtDepth;
 
angevoyageur:

There is a bug in ZigZag indicator in this case, I have already reported it to Service Desk.

The problem arises when ExtDepth (1st) input parameter is lower than ExtBackstep (3rd) input parameter. I applied to following correction :

in place of

Wow, thanks. I spent quite some time on this!
 
angevoyageur:

There is a bug in ZigZag indicator in this case, I have already reported it to Service Desk.

The problem arises when ExtDepth (1st) input parameter is lower than ExtBackstep (3rd) input parameter. I applied to following correction :

in place of

Finally I got the complete thing to work! Thanks angevoyageur! It has been quite a trip since I started with mql5 some days ago.


 
PzTrading:

Finally I got the complete thing to work! Thanks angevoyageur! It has been quite a trip since I started with mql5 some days ago.


You are welcome.
Reason: