Download MetaTrader 5
To add comments, please log in or register
Have you developed a trading robot? Publish it in the Market and make profit!
moonsboy
889
moonsboy 2015.01.16 07:17 

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
9543
Keith Watford 2015.01.16 07:55  

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
889
moonsboy 2015.01.16 09:16  
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
14236
whroeder1 2015.01.16 17:34  
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
889
moonsboy 2015.01.17 00:31  

 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
1401
SYED NAUFAL GADDAFI 2015.01.17 01:32  
double iZig0=iCustom(Symbol(),0,"\\zigzag.ex4",12,5,3,0,i);

Try removing it.

moonsboy
889
moonsboy 2015.01.19 03:37  
deysmacro:

Try removing it.


 

Dear Deysmacro,

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

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2015.01.19 04:31  
Google how to use icustom properly.
moonsboy
889
moonsboy 2015.01.19 05:04  

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

Who can help? 

Keith Watford
Moderator
9543
Keith Watford 2015.01.19 07:28  
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
889
moonsboy 2015.01.19 08:46  
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