Quote:
|
Originally Posted by ShaderZ
Hi,
Could someone explain to me how the inputs for the ZigZag indicator work? I tried looking through the code but there arn't any comments explaining how to use them, or how they affect the indicator. Ive been scratching my head at this problem for quite a while and finally decided to ask for some help.
Inputs for ZigZag indicator:
ExtDepth
ExtDeviation
ExtBackstep
And also. Why does this happen?:

|
I am not expert on zigzag but I think that it is seaching the low (for example) from the current bar up to ExtDepth periods back (ExtDepth bars back). If the new Low was not fould the indicator returns zero (no new Low).
Code:
val=Low[Lowest(NULL,0,MODE_LOW,ExtDepth,shift)];
if(val==lastlow) val=0.0;
If the new Low was found so the indicator check this current new Low with the previous Low and if the current new Low is higher of the previous Low on the ExtDeviation point (if ExtDeviation=5 so if new Low is higher previous Low on 5 point) the indicator will not consider this new Low as a Low and we will still have the previous one:
Code:
if((Low[shift]-val)>(ExtDeviation*Point)) val=0.0;
What is ExtBackstep?
If we have several equal Lows (with the same value) so the indicator will consider the last one only.
If the current Low is higher than previous one but not more higher then previos Low plus ExtDeviation so we have the following:
Code:
for(back=1; back<=ExtBackstep; back++)
It means that indicator will check everything from the previous bar up to ExtBackstep bar.