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

New version of SR ZigZag Trend



PureBytes Links

Trading Reference Links

This new version of SR ZigZag Trend has a few less N/A bars and it also
fixes a problem of failure, which occurred when the last two swing points
were identical.
The code is also quite simpler and easy to follow.
Therefore, please delete the old version and keep this one.
If you have made copies with fixed percentages (SR ZigZag Trend 3%, 5%
...etc), please correct those too.
Sorry for the inconvenience, but bugs are very much attracted to my code.


{SR ZigZag Trend}
{by Spyros Raftopoulos}
{E-mail :  raftsp@xxxxxxxxx}

{It is based on the Zig Zag indicator and it returns 1 for a confirmed
uptrend, and -1 for a confirmed downtrend}

perc:=Input("percent",1,100,10);

tr:=Trough(1,C,perc);
pk:=Peak(1,C,perc);

res:=If(Cross(C,tr+tr*perc/100) AND Zig(C,perc,%)>Ref(Zig(C,perc,%),-1),1,
If(Cross(pk-pk*perc/100,C) AND Zig(C,perc,%)<Ref(Zig(C,perc,%),-1),-1,0));
res:=If(res<>0,res,ValueWhen(1,res<>0,res));
res

Spyros

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 19/04/02




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.351 / Virus Database: 197 - Release Date: 19/04/02