Download MetaTrader 5

How to get time or shift of zigzag top (or bottom)

To add comments, please log in or register
How to test a program before buying?
olzonpon
305
olzonpon 2015.09.21 18:57 

Hi i use this code in my EA to use Zigzag indicator

 int q, l;

   double r0, r1, r2, r3, r4, r5;
   l=0;
      while(q<5)
      {
      if(r0>0) {r5=r4; r4=r3; r3=r2; r2=r1; r1=r0; }
      r0=iCustom(Symbol(),0,"zigzag",depth,5,3,0,l);
      if(r0>0) {q+=1; }
      l++;
      }


The latest value of zigzag indicator is r4, and second r3, third r2 and so on....

But how do i, for example get the the time or shift of r2 ?

Marco vd Heijden
Moderator
4684
Marco vd Heijden 2015.09.21 22:29  

you use the same bar shift values but with:

Time[]
Time[bar]
olzonpon
305
olzonpon 2015.09.22 07:36  
Marco vd Heijden:

you use the same bar shift values but with:

But i don't have the shift values.? Or can i use r2 as shift value like:

Time[r2]
olzonpon
305
olzonpon 2015.09.22 12:06  

Aha ok i got it now its the int "l"

Thanks Marco! =)

To add comments, please log in or register