Download MetaTrader 5

What value does the code get ?

To add comments, please log in or register
moonsboy
890
moonsboy  

After I read the indicator, I still don't understand what value I get with iZig0.

Who is familar with zigzag and iCustom()? Could you please help on this? Thanks.  

 

for(i=1; i<ZZBars; i++)
      double iZig0=iCustom(Symbol(),0,"\\zigzag.ex4",ZZDepth,ZZDev,ZZBack,0,i);
Keith Watford
Moderator
8293
Keith Watford  

Open the data window (ctrl D) with the ZigZag on the chart and move the cursor across the chart. You will see the values that you retrieve from the iCustom call..

If there is a value displayed then it is at either a zigzag high or a zigzag low.

moonsboy
890
moonsboy  
GumRai:

Open the data window (ctrl D) with the ZigZag on the chart and move the cursor across the chart. You will see the values that you retrieve from the iCustom call..

If there is a value displayed then it is at either a zigzag high or a zigzag low.

Dear GumRai, thank you very much!

It's strange that the data window shows correctly there's no value for the newest bar, but  the code shows iZig0 is changing every tick

whroeder1
17112
whroeder1  
jollydragon: It's strange that the data window shows correctly there's no value for the newest bar, but  the code shows iZig0 is changing every tick. 
Your code (as posted)
for(i=1; i<ZZBars; i++)
      double iZig0=iCustom(Symbol(),0,"\\zigzag.ex4",ZZDepth,ZZDev,ZZBack,0,i);

Equivalent
      double iZig0=iCustom(Symbol(),0,"\\zigzag.ex4",ZZDepth,ZZDev,ZZBack,0,ZZBars-1);


Try dropping the \\ and the .ex4. Detailed explanation of iCustom - MQL4 forum

moonsboy
890
moonsboy  

 Dear WHRoeder,

 

Below is the code. Could you please suggest why the range in Print() is changing with every tick?

You know the values from zigzag should be consolidated unless latest price is really over than previous high or low.

When you test in live account, it always is changing with every tick price change. Could you kindly help? Thanks.  

   int c=0;
   double zigZag0,zigZag1,zigZag2;
   for(i=1; i<500; i++)
     {
      double iZig0=iCustom(Symbol(),0,"\\zigzag.ex4",12,5,3,0,i);
      if(iZig0>pipPoints && c==0)
        {
         zigZag0=iZig0;
         c=c+1;
         continue;
        }
      if(iZig0>pipPoints && c==1)
        {
         zigZag1=iZig0;
         c=c+1;
         continue;
        }
      if(iZig0>pipPoints && c==2)
        {
         zigZag2=iZig0;
         c=c+1;
         continue;
        }
      if(c>2) break;
     }
   double high0=MathMax(zigZag0,zigZag1);
   high1=MathMax(high0,zigZag2);
   double low0=MathMin(zigZag0,zigZag1);
   low1=MathMin(low0,zigZag2);
   Print("range is ", high1-low1);
Syed Naufal Gaddafi
1469
Syed Naufal Gaddafi  
double iZig0=iCustom(Symbol(),0,"\\zigzag.ex4",12,5,3,0,i);

Try removing it.

moonsboy
890
moonsboy  
deysmacro:

Try removing it.


 

Dear Deysmacro,

   Thank you. But I want to know the root cause instead of the solution. 

Syed Naufal Gaddafi
1469
Syed Naufal Gaddafi  
Google how to use icustom properly.
moonsboy
890
moonsboy  

Even after checking the use of icustom, I can't know the root cause.

Who can help? 

Keith Watford
Moderator
8293
Keith Watford  
jollydragon:

Even after checking the use of icustom, I can't know the root cause.

Who can help? 

What indicator do you load onto the chart.

Is it called "\\zigzag.ex4"  or "zigzag" ?

moonsboy
890
moonsboy  
GumRai:

What indicator do you load onto the chart.

Is it called "\\zigzag.ex4"  or "zigzag" ?

 

Dear GuiRai,

     it's "\\zigzag.ext".

    No matter which, please understand I want to know why the 'range' printed by my codes is changing with every tick.

    I don't want to fix it by this thread. But know about the root cause.  

12
To add comments, please log in or register