SLIGHTLY IMPROVED ZIGZAG TEST
Hi Gary,
Here is a small improvement to the zigzag test in that, by requiring that Stochastics be above or below 50 for entry, there are slightly fewer unprofitable trades and thus a higher win/loss ratio. It takes a little longer to run.
ENTER LONG
(Zig(C, opt1, %) > Ref(Zig(C, opt1, %),-1) AND Ref(Zig(C, opt1, %),-1) < Ref(Zig(C, opt1, %),-2) AND Stoch(10,2) <= 50)
CLOSE LONG
(Zig(C, opt1, %) < Ref(Zig(C, opt1, %),-1) AND Ref(Zig(C, opt1, %),-1) > Ref(Zig(C, opt1, %),-2) AND Stoch(10,2) > 50)
OR
(L < 0.99*(ValueWhen(1,Zig(C, opt1, %) > Ref(Zig(C, opt1, %),-1) AND Ref(Zig(C, opt1, %),-1) < Ref(Zig(C, opt1, %),-2) AND Stoch(10,2) <= 50 , L)))
ENTER SHORT
(Zig(C, opt1, %) < Ref(Zig(C, opt1, %),-1) AND Ref(Zig(C, opt1, %),-1) > Ref(Zig(C, opt1, %),-2) AND Stoch(10,2) > 50)
CLOSE SHORT
(Zig(C, opt1, %) > Ref(Zig(C, opt1, %),-1) AND Ref(Zig(C, opt1, %),-1) < Ref(Zig(C, opt1, %),-2) AND Stoch(10,2) <= 50)
OR
(H > 1.01*(ValueWhen(1, Zig(C, opt1, %) < Ref(Zig(C, opt1, %),-1) AND Ref(Zig(C, opt1, %),-1) > Ref(Zig(C, opt1, %),-2) AND Stoch(10,2) > 50 , H)))
Opt 1 is 2 to 10, steps 0.1
Notes:
- Testing each stock with the zigzag takes only 15-25 seconds
- The 'ValueWhen' function in the closing formulae above serves as a stop loss to exit when the low is 1% less than the low on the signal entry day (longs) or the high is 1% higher than the high on the signal entry day (shorts).
- I do not set any other stops.
- Only use the zigzag test to confirm / time another indicator as the last 'zag' can vary depending on the %change of the last day
John
|