Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 10/29/2004(UTC) Posts: 1,394 Location: Glastonbury, CT
Was thanked: 2 time(s) in 2 post(s)
|
In the Feb 2005 TASC , the article by Jim Berg about Volatility, here is the code as translated from the AMIBROKER Code into Metastock.
The Indicator called Tstop
Tstop1:=HHV(C-(2*ATR(10)),15);
Tstop2:=LLV(C+(2*ATR(10)),15);
PT1:=Mov(H,13,E)+(2*ATR(10));
PT2:=Mov(L,13,E)-(2*ATR(10));
Mi:=(PT1-PT2)/2 +PT2;
A:=C>(LLV(L,20)+(2*ATR(10)));
B:=C<(HHV(H,20)-(2*ATR(10)));
D:=If(BarsSince(A)<BarsSince(B),-1,If(BarsSince(A)>BarsSince(B),1,0));
TS:=If(D=-1,Tstop1,If(D=1,Tstop2,PREV));
PT:=If(D=-1,PT1,If(D=1,PT2,PREV));
TS;Mi;PT;
The expert called Truth about Volatility
Highlights tab
Long
A:=C>(LLV(L,20)+(2*ATR(10)));
B:=C<(HHV(H,20)-(2*ATR(10)));
D:=If(BarsSince(A)<BarsSince(B),-1,If(BarsSince(A)>BarsSince(B),1,0));
D=-1
Short
A:=C>(LLV(L,20)+(2*ATR(10)));
B:=C<(HHV(H,20)-(2*ATR(10)));
D:=If(BarsSince(A)<BarsSince(B),-1,If(BarsSince(A)>BarsSince(B),1,0));
D=1
Out
A:=C>(LLV(L,20)+(2*ATR(10)));
B:=C<(HHV(H,20)-(2*ATR(10)));
D:=If(BarsSince(A)<BarsSince(B),-1,If(BarsSince(A)>BarsSince(B),1,0));
D=0
Symbol Tab
LE
A:=C>(LLV(L,20)+(2*ATR(10)));
B:=C<(HHV(H,20)-(2*ATR(10)));
D:=If(BarsSince(A)<BarsSince(B),-1,If(BarsSince(A)>BarsSince(B),1,0));
D=-1 AND Ref(D,-1)>-1
SE
A:=C>(LLV(L,20)+(2*ATR(10)));
B:=C<(HHV(H,20)-(2*ATR(10)));
D:=If(BarsSince(A)<BarsSince(B),-1,If(BarsSince(A)>BarsSince(B),1,0));
D=1 AND Ref(D,-1)<1
LX
A:=C>(LLV(L,20)+(2*ATR(10)));
B:=C<(HHV(H,20)-(2*ATR(10)));
D:=If(BarsSince(A)<BarsSince(B),-1,If(BarsSince(A)>BarsSince(B),1,0));
D=0 AND Ref(D,-1)=-1
SX
A:=C>(LLV(L,20)+(2*ATR(10)));
B:=C<(HHV(H,20)-(2*ATR(10)));
D:=If(BarsSince(A)<BarsSince(B),-1,If(BarsSince(A)>BarsSince(B),1,0));
D=0 AND Ref(D,-1)=1
|