Rank: Advanced Member
Groups: Registered, Registered Users Joined: 1/19/2005(UTC) Posts: 1,065 Location: Koh Pha-Ngan, Earth
Was thanked: 2 time(s) in 2 post(s)
|
The "P" variable in the formula can be a problem if no plot is highlighted before the exploration is run.
Try this "P"-less version of the same indicator:
[code:1:afbc4569ab]
{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 Vol=5 WCl=6",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,WC(),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))
[/code:1:afbc4569ab]
jose '-)
|