[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ZigZag validity indicator



PureBytes Links

Trading Reference Links

It is well known that although the zigzag indicator is a useful tool in
filtering out market moves of minor importance (noise), its last "leg" is
dynamic. This means that the last change in the indicator's direction may
well be revised, as long as the predefined user's value (change in points or
percentage) since the last swing point is not reached yet. The point, beyond
which the zigzag indicator's last leg is trustworthy, is defined by the
distance (change in points or percentage) between the last price and the
last swing point (peak or trough). From that point on, the zigzag indicator
is valid, meaning that the direction of its last leg will not be revised.

The following binary indicator shows the validity of the last leg of the
zigzag indicator based on close prices and percentages. Instead of close
prices one may use open, high or low as well as points instead of
percentage, adapting the formula accordingly.
In order to check ZigZag validity, use a zigzag of close and check the
percent radio button. Use the same percentage value for both the zigzag and
ZigZag validity.
As you will notice my indicator will drop to 0 (zero) each time a new
direction of the zigzag indicator is initialized. It then rises to 1 (one)
at the critical (no-return) point and it stays there until a new change
occurs.

ZigZag validity

{1 = valid, 0 = invalid}
perc:=Input("Percent",1,200,10);
Z:=Zig(C,perc,%);
last:=ValueWhen(1,( Z > Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2) )
OR ( Z < Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2) ), Ref(Z,-1) );
pc:=If(C > last, (C-last) * 100 / last, (last-C) * 100 / last);
pc:= Abs(pc);
cdBars:= BarsSince( (Z<Ref(Z,-1) AND Ref(Z,-1)>Ref(Z,-2) ) OR
(Z>Ref(Z,-1) AND Ref(Z,-1)<Ref(Z,-2) ));
ind:=If(pc>=perc,1,0);
indBars:= BarsSince(ind=1 AND Ref(ind,-1)=0);
If(indbars<cdBars,1,0);

I hope this is useful.
Any feedback will be appreciated.

SR