• Get access

iCustom() missing values

To add comments, please log in or register
Matt
77
Matt  

I'm using iCustom() to access values for ZigZag. It is not seeing values for low ZigZag points. Here's the function:

void CheckOpen(){
   double LastZZ, ZZarray[];
   int MaxIdx;
   ArrayResize(ZZarray,ExtZZBackstep);  
   for(int i=0;i<=ExtZZBackstep-1;i++){
      ZZarray[i] = iCustom(NULL, 0, "ZigZag",ExtZZDepth,ExtZZDeviation,ExtZZBackstep,0,i);
   }//endfor backstep
   MaxIdx=ArrayMaximum(ZZarray);
   LastZZ=ZZarray[MaxIdx];
   if(LastZZ!=0){
      if(Ask<NormalizeDouble(LastZZ,4)){OpenShort();}
      else{OpenLong();}
   }//endif ZZ   
   return;}//end CheckOpen


This is about the 3rd way I've tried to look for the low zig zag points. The lows should have a value equal to the low. This routine (and the others I tried before it) all find the highs without difficulty, but they never see the lows, and skip right past as if those bars have no zigzag value assigned.

Is there a problem with iCustom? Or ZigZag? Or my interpretation of them?

Was trying to use iCustom to save time, and now I'm wondering if it would've been quicker to rebuild ZigZag within the EA.

Thanks for the help!

--Matt

Andrew Bishop
41
Andrew Bishop  
Hey Matt,
I have had alot of trouble with the structure of the iCustom, infact I'm still fighting with my script to try and get it right. I found that if I add an extra 0,1 or so to the iCustom call I find it helps to get the second value.
for example:
ZZarray[i] = iCustom(NULL, 0, "ZigZag",ExtZZDepth,ExtZZDeviation,ExtZZBackstep,0,i,0,1);
or
ZZarray[i] = iCustom(NULL, 0, "ZigZag",ExtZZDepth,ExtZZDeviation,ExtZZBackstep,0,i,1);

Mind you, you might have to try and probe the value to see if it's the one your lookin for. I hope that was of some help.

On another matter, do you build custom experts for people?

Thanks,
Andrew
Andrew Bishop
41
Andrew Bishop  
Hello Again,
After rereading your post, I realized that you might be putting the value in a list. I don't think that would make any difference, but my prevous answer would give you the second, or lower value, but not the first. If you need both you might need to declare 2 seperate variables. I also thought when I read your post that maybe there was some way to output both the values of the zigzag into the list variable, but I'm not sure. Well, I hope this would be of some help.

Andrew.
Matt
77
Matt  

Thanks, Andrew, I may give that a try.

As far as 2 values, if you examine the ZigZag code, both values end up the same for a given point. It runs through and finds the local highs and lows, then it goes back through again and keeps only the extremes (if you have hi then a hi, then it only keeps the higher hi, and this ensures a zig-zag, hi-lo-hi-lo pattern) and the last time through it sets both values to the same value. So, both values inside of ZigZag both return the zig zag value for a point. Any non-extreme bar will have zig zag value of zero. The extremes will have zigzag value of their price. However, the lows are not showing up. Very odd.

Thanks for the help, I'll look at sticking in extra parameters and such. I am probably just going to have to build my own zigzag code, which I really was hoping wasn't necessary after discovering iCustom. Hopefully the MQL4 folks will chime in and show me my glaring error so I can fix it and move on!

-Matt

To add comments, please log in or register