logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Nevadagold  
#1 Posted : Monday, September 27, 2010 6:50:49 AM(UTC)
Nevadagold

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 9/13/2010(UTC)
Posts: 7

Hello all,

I'm trying to create a System Tester that uses the Vervoort ATR Trailing stop. I look for confirmation of the weekly and the daily charts. The code for the trailing stop indicator I use on either daily or weekly charts is:

{SVE_Stop_Trail_ATR_Mod}
period:=Input("ATR period:",1,100,5);
atrfact:=Input("ATR multiplication:",1,10,3.5);
HiLo:=If(H-L<1.5*Mov(H-L,period,S),H-L, 1.5*Mov(H-L,period,S));
Href:=If(L<=Ref(H,-1),H-Ref(C,-1),(H-Ref(C,-1))-(L-Ref(H,-1))/2);
Lref:=If(H>=Ref(L,-1),Ref(C,-1)-L,(Ref(C,-1)-L)-(Ref(L,-1)-H/2));
diff1:=Max(HiLo,Href);
Diff2:=Max(diff1,Lref);
atrmod:=Wilders(diff2,period);
loss:=atrfact*atrmod;
trail:=
If(C>PREV AND Ref(C,-1)>PREV,
Max(PREV,C-loss),
If(C<PREV AND Ref(C,-1)<PREV,
Min(PREV,C+loss),
If(C>PREV,C-loss,C+loss)));
Trail

Obviously this will give a different result based on the periodicity of the chart it is plotted on. Since I'm using daily data for the System Tester I want to be able to re-create the trailing stop this formula calculates on the weekly chart on the daily, (this is a key buy confirmation and sell trigger for me). I thought that if I used the HHV(H,5) and LLV(L,5) in place of the H and L in the formula I might get close. This is the code I derived:

{SVE_Stop_Trail_ATR_Mod}
period:=Input("ATR period:",1,100,5);
atrfact:=Input("ATR multiplication:",1,20,3.5);
HiLo:=If((HHV(H,5)-(LLV(L,5))<1.5*Mov((HHV(H,5)-(LLV(L,5))),period,S)),((HHV(H,5)-(LLV(L,5)))),1.5*Mov((((HHV(H,5)-(LLV(L,5))))),period,S));
Href:=If(((LLV(L,5)<=Ref((HHV(H,5)),-1))),((HHV(H,5))-Ref(C,-1)),((HHV(H,5))-Ref(C,-1)))-(((LLV(L,5)-Ref(HHV(H,5),-1)/2)));
Lref:=If(((HHV(H,5))>=Ref((LLV(L,5)),-1)),Ref(C,-1)-((LLV(L,5))),(Ref(C,-1)-((LLV(L,5)))-((Ref((LLV(L,5)),-1)-(HHV(H,5)))/2)));
Diff1:=Max(HiLo,Href);
Diff2:=Max(diff1,Lref);
atrmod:=Wilders(diff2,period);
loss:=atrfact*atrmod;
trail:=
If(C>PREV AND Ref(C,-1)>PREV,
Max(PREV,C-loss),
If(C<PREV AND Ref(C,-1)<PREV,
Min(PREV,C+loss),
If(C>PREV,C-loss,C+loss)));
Trail

When I plot this on a daily chart and compare it to the weekly it still doesn't align. Clearly I'm no wizard--any suggestions?

thanks

Glen

mstt  
#2 Posted : Monday, September 27, 2010 8:12:12 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Glen I've created what appears to be a fully functioning Multi-Frame version of the Sylvain VerVoort trailing stop but have forgotten how to post the code without corruption. Email me and it's yours. Roy
Nevadagold  
#3 Posted : Tuesday, September 28, 2010 5:33:15 AM(UTC)
Nevadagold

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 9/13/2010(UTC)
Posts: 7

Roy--email sent!

many thanks

Glen

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.