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

[Metastockusers] ZigZag validity revisited



PureBytes Links

Trading Reference Links

Here is Spyros' (and some of Roy's) code, cleaned up, and with 
additional features:


====================
ZigZag validity v2.1
====================

---8<----------------------------

{ZigZag validity engine by Spyros Raftopoulos}
{additional code by Jose Silva}
{1=ZigZag valid, 0=ZigZag invalid}

perc:=Input("ZigZag percent",.1,100,5);
plot:=Input("plot:  signals=1,  % of valid signals=2,  ZigZag=3",1,3,
1);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,4);

x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
z:=Zig(x,perc,%);
z1:=Ref(z,-1);
z2:=Ref(z,-2);
last:=ValueWhen(1,z>z1 AND z1<z2
 OR z<z1 AND z1>z2,z1);
pc:=Abs((x-last)*100/last);
SD:=z>z1 AND z1>z2 OR z<z1 AND z1<z2;
res:=pc>=perc;
valid:=If(Alert(res,2) AND SD,1,res);
validper:=Cum(valid)/Cum(valid>-1)*100;

If(plot=3,z,If(plot=2,validper,valid))

---8<----------------------------


Interesting to see how validity % decreases with higher value ZigZags.

jose '-)




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/