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

Notification

Icon
Error

Options
Go to last post Go to first unread
Thom  
#1 Posted : Sunday, August 19, 2007 1:52:41 PM(UTC)
Thom

Rank: Member

Groups: Registered, Registered Users
Joined: 1/5/2006(UTC)
Posts: 14

I'm trying to test reliability of various entry strategies and need help coding the exits.

For instance, I want the system tester to exit "X" number of days after an entry; I can't seem to figure out how to code the exit. How do I tell the system tester to exit the position 5 days after the entry (or 2 days, 10 days, etc.)?

Any help would be appreciated!

Cheers,

Thom

mstt  
#2 Posted : Sunday, August 19, 2007 2:28:26 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)

Thom

Here's a formula you could use to provide a timed exit. Typically you would define conventional entry and exit (if used) signals than then apply them to this PREV latch as the "N" and "X" variables.

D:= 5; {exit delay periods};

N:=Fml("your entry formula"); {entry signal here}

X:=0; {Fml("your conventional exit formula");} {exit signal here}

R:=If(PREV<=0,N, X OR If(BarsSince(PREV<=0)>=D,-PREV,PREV));

Exit:=R<0;

Exit

There's also a Simulation function that can be used to time the age of the position and generate an exit. Simulation functions tend to be even more resource hungry than PREV so the EST will also run slowly when they are used.

Another common method is to use a Stop not reaching an extreme dollar or percentage gain or loss within a specified number of bars.

Roy

MetaStock Tips & Tools

Thom  
#3 Posted : Tuesday, August 21, 2007 7:41:08 PM(UTC)
Thom

Rank: Member

Groups: Registered, Registered Users
Joined: 1/5/2006(UTC)
Posts: 14

Thanks Roy.

I haven't ventured into the area of "defining" variables in formulas so I'm not sure I completely understand the formula you've provided, but I'll try to work through it.

I see that "R" is defined with the inclusion of "X", and that "X" is defined as my "conventional exit formula"; however, there is no exit formula: the exit is simply "X" number of days from the entry and this is the area that's being problematic. If there is an exit formula to define as "X", an example would be, "exit 5 days after entry". This is the formula I can't figure out. So, as is, I can't define "X". Any thoughts?

Thanks,

Thom

mstt  
#4 Posted : Tuesday, August 21, 2007 8:10:39 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 Thom

Leave "X" as it is (as presented it's defined as always being false or zero), or you could remove all references to "X" be removing the definition line and also removing "X OR" from the "R" variable definition. With "X" defined as always false or removed altogether the "R" variable acts as a PREV latch that resets when "time since entry" equals the exit delay value.

Try this ...

D:= 5; {exit delay periods};

N:=Fml("your entry formula"); {entry signal here}

X:=0;

R:=If(PREV<=0,N, X OR If(BarsSince(PREV<=0)>=D,-PREV,PREV));

Exit:=R<0;

Exit

Or this ...

D:= 5; {exit delay periods};

N:=Fml("your entry formula"); {entry signal here}

R:=If(PREV<=0,N,If(BarsSince(PREV<=0)>=D,-PREV,PREV));

Exit:=R<0;

Exit

Roy

MetaStock Tips & Tools

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.