Rank: Newbie
Groups: Registered, Registered Users Joined: 3/23/2011(UTC) Posts: 5
|
{The two indicators were taken from Jose Silva's site}
===================
ZigZag Cycle Length
===================
---8
{ Price peak/trough cycle length v4.0 }
{ Warning: last peak/trough is dynamic!}
{ Plot in own window below price chart }
{ 6/4/2004 ASX 1152 active stocks exploration,
3.25% ZigZag cycle lengths, mean price cycles:
3.7 trade days for positive price cycles;
4.5 trade days for negative price cycles;
8.2 trade days complete price cycles.}
{ ©Copyright 2004 Jose Silva }
{ http://www.metastocktools.com }
zzper:=Input("ZigZag reversal %",.001,100,3.25);
pds:=Input("avg StdDev periods",2,2520,7);
plot:=Input("[1]Cycles, [2]Cycle Avg, [3]Avg StdDev, [4]ZigZag",1,4,1);
pk:=PeakBars(1,C,zzper)=0;
tr:=TroughBars(1,C,zzper)=0;
lastBar:=Cum(1)=LastValue(Cum(1));
lastLeg:=lastBar*LastValue(BarsSince(pk OR tr));
CycleUp:=pk*BarsSince(tr);
CycleUpAvg:=
Cum(CycleUp)/(Cum(CycleUp>0)+.000001);
CycleUpStdDev:=Stdev(CycleUp,pds);
CycleUpStdDevAvg:=Cum(CycleUpStdDev)
/(Cum(CycleUpStdDev>0)+.000001);
CycleDw:=tr*BarsSince(pk);
CycleDwAvg:=
Cum(CycleDw)/(Cum(CycleDw>0)+.000001);
CycleDwStdDev:=Stdev(CycleDw,pds);
CycleDwStdDevAvg:=Cum(CycleDwStdDev)
/(Cum(CycleDwStdDev>0)+.000001);
statCycle:=CycleUp-CycleDw;
lastLeg:=If(ValueWhen(1,pk OR tr,statCycle)<0,
lastleg,-lastleg)*lastBar;
cycle:=statCycle+lastLeg;
zz:=Zig(cycle,zzper,%);
plotUp:=If(plot=1,0,
If(plot=2,CycleUpAvg,
If(plot=3,CycleUpStdDevAvg,0)));
plotDw:=If(plot=1,cycle,
If(plot=2,-CycleDwAvg,
If(plot=3,-CycleDwStdDevAvg,zz)));
plotUp;plotDw
---8
{And I called this Zig2}
pr:=Input("ZigZag reversal %",.01,100,5);
x:=Input("use: [1]Open, [2]High, [3]Low, [4]Close,[5]WghtCl",1,5,4);plot:=Input("plot:1]Signals,[2]ZigZag",1,2,1);x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=4,C,WC()))));zz:=Zig(x,pr,%);sell:=PeakBars(1,x,pr)=0;buy:=TroughBars(1,x,pr)=0;If(plot=1,buy-sell,zz)
{The indicator I made,called ZigZig}
If(FmlVar("Zig2","BUY") AND FmlVar("ZigZag Cycle Length","PLOTDW") <= -5,1,0)
{As I am only interested in searching buy signals}
{And the explorer-ColA-:}
If(Ref(Fml( "ZigZig"),-1)=1, 1,0)
{Filter}ColA
{ As an example the security CCL from the ASX does not show up on the explorer the last signal for this stock was Jan 4 so I change the date to Jan 5 and it gives normal filter rejection, same for all signals on this stock}
|