| |
|
|
Zero-lag
IIR Filter
pds:=Input("number of periods",1,20,5); x:=2/(pds+1);
xl:=LastValue((1/x)-1); (x*((2*C)-Ref(C,-xl))) +((1-x)*PREV)
|
Zero-lag FIR
Filter
(C + (3.5*Ref(C,-1)) + (4.5*Ref(C,-2)) +
(3*Ref(C,-3)) + (.5*Ref(C,-4)) - (.5*Ref(C,-5)) -
(1.5*Ref(C,-6))) / 10.5
|
Zero Lag EMA
Period:= Input("What Period",1,250,10); EMA1:= Mov(P,Period,E);
EMA2:= Mov(EMA1,Period,E); Difference:= EMA1 - EMA2;
ZeroLagEMA:= EMA1 + Difference; ZeroLagEMA
|
Zero Lag MACD
EMA1:= Mov(CLOSE,13,E); EMA2:= Mov(EMA1,13,E); Difference:=
EMA1 - EMA2; ZeroLagEMA13:= EMA1 + Difference; EMA1:=
Mov(CLOSE,21,E); EMA2:= Mov(EMA1,21,E); Difference:= EMA1 -
EMA2; ZeroLagEMA21:= EMA1 + Difference;
ZeroLagMACD:=ZeroLagEMA13 - ZeroLagEMA21; ZeroLagMACD
|
Zero Lag MACD
Trigger Signal
{ To be used with the ZeroLag MACD above }
EMA1:= Mov(CLOSE,13,E); EMA2:= Mov(EMA1,13,E); Difference:=
EMA1 - EMA2; ZeroLagEMA13:= EMA1 + Difference; EMA1:=
Mov(CLOSE,21,E); EMA2:= Mov(EMA1,21,E); Difference:= EMA1 -
EMA2; ZeroLagEMA21:= EMA1 + Difference;
ZeroLagMACD:=ZeroLagEMA13 - ZeroLagEMA21; EMA1:=
Mov(ZeroLagMACD,8,E); EMA2:= Mov(EMA1,8,E); Difference:= EMA1
- EMA2; ZeroLagTRIG:= EMA1 + Difference; ZeroLagTRIG
|
Zigzag Targets
x:=Input("number of time periods in average",10,200,40); x2:=x*2;
pd:=C-Mov(C,x,E); hpd:=HHV(pd,x2); lpd:=LLV(pd,x2);
nf:=200/(hpd-lpd); ((pd-lpd)*nf)-100
|
|
 |
 |
|
ZigZag Trend (SR ZZT) v.4
{by Spyros Raftopoulos}
{It is based on the Zig Zag indicator and it
returns 1 for a confirmed uptrend, and -1 for a confirmed
downtrend.}
{****************************************}
vr:=Input("Field (0=Ind/tor, 1=Open, 2=High,
3=Low, 4=Close)",0,4,0); amnt:=Input("Reversal
amount",0.001,1000,10); md:=Input("Method (1=Percent,
2=Points)",1,2,1);
{****************************************}
vr:=If(vr=1,OPEN,If(vr=2,HIGH,If(vr=3,LOW,If(vr=4,CLOSE,P))));
zz0:=If(md=1, Zig(vr,amnt,%), Zig(vr,amnt,$)); zz1:=Ref(zz0,-1);
zz2:=Ref(zz0,-2);
{****************************************}
tr:=ValueWhen(1,zz0>zz1 AND zz1<zz2, zz1);
pk:=ValueWhen(1,zz0<zz1 AND zz1>zz2, zz1);
PU:=If(md=1,tr+Abs(tr)*amnt/100,tr+amnt);
PD:=If(md=1,pk-Abs(pk)*amnt/100,pk-amnt);
res:=If(vr>=PU AND zz0>zz1,1, If(vr<=PD AND
zz0<zz1,-1,0)); res:=If(res<>0,res,ValueWhen(1,res<>0,res));
res
|
SR ZZT1
{******************** Start of code
**********************} {SR ZZT1} amnt:=3; {This is
different for each of the 5 indicators}
{ Don't change anything below this line
unless you know what you are doing} md:=1; vr:=CLOSE;
zz0:=If(md=1, Zig(vr,amnt,%), Zig(vr,amnt,$));
zz1:=Ref(zz0,-1); zz2:=Ref(zz0,-2);
tr:=ValueWhen(1,zz0>zz1 AND zz1<zz2, zz1);
pk:=ValueWhen(1,zz0<zz1 AND zz1>zz2, zz1);
PU:=If(md=1,tr+Abs(tr)*amnt/100,tr+amnt);
PD:=If(md=1,pk-Abs(pk)*amnt/100,pk-amnt);
res:=If(vr>=PU AND zz0>zz1,1, If(vr<=PD
AND zz0<zz1,-1,0));
res:=If(res<>0,res,ValueWhen(1,res<>0,res)); res
{********************* End of code *********************}
|
SR ZZT2
{******************** Start of code
**********************} {SR ZZT1} amnt:=5; {This is
different for each of the 5 indicators}
{ Don't change anything below this line
unless you know what you are doing} md:=1; vr:=CLOSE;
zz0:=If(md=1, Zig(vr,amnt,%), Zig(vr,amnt,$));
zz1:=Ref(zz0,-1); zz2:=Ref(zz0,-2);
tr:=ValueWhen(1,zz0>zz1 AND zz1<zz2, zz1);
pk:=ValueWhen(1,zz0<zz1 AND zz1>zz2, zz1);
PU:=If(md=1,tr+Abs(tr)*amnt/100,tr+amnt);
PD:=If(md=1,pk-Abs(pk)*amnt/100,pk-amnt);
res:=If(vr>=PU AND zz0>zz1,1, If(vr<=PD
AND zz0<zz1,-1,0));
res:=If(res<>0,res,ValueWhen(1,res<>0,res)); res
{********************* End of code *********************}
|
SR ZZT3
{******************** Start of code
**********************} {SR ZZT1} amnt:=10; {This is
different for each of the 5 indicators}
{ Don't change anything below this line
unless you know what you are doing} md:=1; vr:=CLOSE;
zz0:=If(md=1, Zig(vr,amnt,%), Zig(vr,amnt,$));
zz1:=Ref(zz0,-1); zz2:=Ref(zz0,-2);
tr:=ValueWhen(1,zz0>zz1 AND zz1<zz2, zz1);
pk:=ValueWhen(1,zz0<zz1 AND zz1>zz2, zz1);
PU:=If(md=1,tr+Abs(tr)*amnt/100,tr+amnt);
PD:=If(md=1,pk-Abs(pk)*amnt/100,pk-amnt);
res:=If(vr>=PU AND zz0>zz1,1, If(vr<=PD
AND zz0<zz1,-1,0));
res:=If(res<>0,res,ValueWhen(1,res<>0,res)); res
{********************* End of code *********************}
|
SR ZZT4
{******************** Start of code
**********************} {SR ZZT1} amnt:=15; {This is
different for each of the 5 indicators}
{ Don't change anything below this line
unless you know what you are doing} md:=1; vr:=CLOSE;
zz0:=If(md=1, Zig(vr,amnt,%), Zig(vr,amnt,$));
zz1:=Ref(zz0,-1); zz2:=Ref(zz0,-2);
tr:=ValueWhen(1,zz0>zz1 AND zz1<zz2, zz1);
pk:=ValueWhen(1,zz0<zz1 AND zz1>zz2, zz1);
PU:=If(md=1,tr+Abs(tr)*amnt/100,tr+amnt);
PD:=If(md=1,pk-Abs(pk)*amnt/100,pk-amnt);
res:=If(vr>=PU AND zz0>zz1,1, If(vr<=PD
AND zz0<zz1,-1,0));
res:=If(res<>0,res,ValueWhen(1,res<>0,res)); res
{********************* End of code *********************}
|
SR ZZT5
{******************** Start of code
**********************} {SR ZZT1} amnt:=20; {This is
different for each of the 5 indicators}
{ Don't change anything below this line
unless you know what you are doing} md:=1; vr:=CLOSE;
zz0:=If(md=1, Zig(vr,amnt,%), Zig(vr,amnt,$));
zz1:=Ref(zz0,-1); zz2:=Ref(zz0,-2);
tr:=ValueWhen(1,zz0>zz1 AND zz1<zz2, zz1);
pk:=ValueWhen(1,zz0<zz1 AND zz1>zz2, zz1);
PU:=If(md=1,tr+Abs(tr)*amnt/100,tr+amnt);
PD:=If(md=1,pk-Abs(pk)*amnt/100,pk-amnt);
res:=If(vr>=PU AND zz0>zz1,1, If(vr<=PD
AND zz0<zz1,-1,0));
res:=If(res<>0,res,ValueWhen(1,res<>0,res)); res
{********************* End of code *********************}
|
ZigZag Trend
Sum
{***********************Start of code ***********************}
{SR ZZTsum} Fml("SR ZZT1") + Fml("SR ZZT2") + Fml("SR ZZT3") +
Fml("SR ZZT4") + Fml("SR ZZT5") {*********************** End
of code *********************}
|
ZigZag Validity
{*********** Start of code *************}
{ZigZag validity by Spyros Raftopoulos It
validates the LAST LEG of the Zigzag indicator. 1=valid (not
revisable), 0=invalid (revisable). Do NOT use this indicator in
systems.}
perc:=Input("Percent",0.2,100,10);
Z:=Zig(CLOSE,perc,%); last:=ValueWhen(1,( Z
> Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2) ) OR ( Z < Ref(Z,-1) AND
Ref(Z,-1) > Ref(Z,-2) ), Ref(Z,-1));
pc:=(CLOSE-last) * 100 / last; pc:= Abs(pc);
SD:=(z>Ref(z,-1) AND Ref(z,-1)>Ref(z,-2)) OR
(z<Ref(z,-1) AND Ref(z,- 1)<Ref(z,-2));
res:=If(pc>=perc ,1,0); If(Alert(res,2) AND
SD,1,res)
{*********** End of code *************}
|
|
 |
 |
|
ZigZig Fixed 3%
perc:=3;
tr:=ValueWhen(1,Zig(C,perc,%)>Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)<Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
tr:=If( (C-tr)*100/tr>= perc ,tr,0); tr:=If( tr=0,
ValueWhen(1,tr<>0,tr), tr);
pk:=ValueWhen(1,Zig(C,perc,%)<Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)>Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
pk:=If((C-pk)*100/pk <=-perc , pk, 0); pk:=If( pk=0,
ValueWhen(1,pk<>0,pk), pk); res:=If(pk<>Ref(pk,-1), -1,
If(tr<>Ref(tr,-1), 1, 0));
res:=If(res=0,ValueWhen(1,res<>0,res),res); res
|
ZigZig Fixed 5%
perc:=5;
tr:=ValueWhen(1,Zig(C,perc,%)>Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)<Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
tr:=If( (C-tr)*100/tr>= perc ,tr,0); tr:=If( tr=0,
ValueWhen(1,tr<>0,tr), tr);
pk:=ValueWhen(1,Zig(C,perc,%)<Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)>Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
pk:=If((C-pk)*100/pk <=-perc , pk, 0); pk:=If( pk=0,
ValueWhen(1,pk<>0,pk), pk); res:=If(pk<>Ref(pk,-1), -1,
If(tr<>Ref(tr,-1), 1, 0));
res:=If(res=0,ValueWhen(1,res<>0,res),res); res
|
ZigZig Fixed
10%
perc:=10;
tr:=ValueWhen(1,Zig(C,perc,%)>Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)<Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
tr:=If( (C-tr)*100/tr>= perc ,tr,0); tr:=If( tr=0,
ValueWhen(1,tr<>0,tr), tr);
pk:=ValueWhen(1,Zig(C,perc,%)<Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)>Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
pk:=If((C-pk)*100/pk <=-perc , pk, 0); pk:=If( pk=0,
ValueWhen(1,pk<>0,pk), pk); res:=If(pk<>Ref(pk,-1), -1,
If(tr<>Ref(tr,-1), 1, 0));
res:=If(res=0,ValueWhen(1,res<>0,res),res); res
|
ZigZig Fixed
15%
perc:=15;
tr:=ValueWhen(1,Zig(C,perc,%)>Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)<Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
tr:=If( (C-tr)*100/tr>= perc ,tr,0); tr:=If( tr=0,
ValueWhen(1,tr<>0,tr), tr);
pk:=ValueWhen(1,Zig(C,perc,%)<Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)>Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
pk:=If((C-pk)*100/pk <=-perc , pk, 0); pk:=If( pk=0,
ValueWhen(1,pk<>0,pk), pk); res:=If(pk<>Ref(pk,-1), -1,
If(tr<>Ref(tr,-1), 1, 0));
res:=If(res=0,ValueWhen(1,res<>0,res),res); res
|
ZigZig Fixed
20%
perc:=20;
tr:=ValueWhen(1,Zig(C,perc,%)>Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)<Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
tr:=If( (C-tr)*100/tr>= perc ,tr,0); tr:=If( tr=0,
ValueWhen(1,tr<>0,tr), tr);
pk:=ValueWhen(1,Zig(C,perc,%)<Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)>Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
pk:=If((C-pk)*100/pk <=-perc , pk, 0); pk:=If( pk=0,
ValueWhen(1,pk<>0,pk), pk); res:=If(pk<>Ref(pk,-1), -1,
If(tr<>Ref(tr,-1), 1, 0));
res:=If(res=0,ValueWhen(1,res<>0,res),res); res
|
ZigZig Fixed
Fml( "ZigZig Fixed 3%" ) + Fml( "ZigZig
Fixed 5%" ) + Fml( "ZigZig Fixed 5%" ) + Fml( "ZigZig Fixed
10%" ) + Fml( "ZigZig Fixed 15%" ) + Fml( "ZigZig Fixed 20%" )
|
Zig Zag Fixed
All
perc:=Input("percent",1,100,10);
tr:=ValueWhen(1,Zig(C,perc,%)>Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)<Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
tr:=If( (C-tr)*100/tr>= perc ,tr,0); tr:=If( tr=0,
ValueWhen(1,tr<>0,tr), tr);
pk:=ValueWhen(1,Zig(C,perc,%)<Ref(Zig(C,perc,%),-1) AND
Ref(Zig(C,perc,%),-1)>Ref(Zig(C,perc,%),-2),Ref(Zig(C,perc,%),-1));
pk:=If((C-pk)*100/pk <=-perc , pk, 0); pk:=If( pk=0,
ValueWhen(1,pk<>0,pk), pk); res:=If(pk<>Ref(pk,-1), -1,
If(tr<>Ref(tr,-1), 1, 0));
res:=If(res=0,ValueWhen(1,res<>0,res),res); res
|
|
 |
 |
|
ZlagemaNZ
N:=10; TN:=Mov(CLOSE,N,S);
s1:=((n-1)/2)*C+((n-3)/2)*Ref(C,-1)+((n-5)/2)*Ref(C,-2)+((n-7)/2)*Ref(C,-3)+
((n-9)/2)*Ref(C,-4)+((n-11)/2)*Ref(C,-5)+((n-13)/2)*Ref(C,-6)
+((n-15)/2)*Ref(C,-7)+((n-17)/2)*Ref(C,-8)+((n-19)/2)*Ref(C,-9);
y2:=TN+(6*S1)/((n+1)*n); y2
|
| |
|