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

Notification

Icon
Error

Options
Go to last post Go to first unread
donpantits  
#1 Posted : Saturday, January 30, 2010 2:44:22 AM(UTC)
donpantits

Rank: Newbie

Groups: Registered, Registered Users
Joined: 1/30/2010(UTC)
Posts: 2

Hello everybody In a system tester, I want the exit to be X days after the long or short position For example, Buy Order : c > ref(c,-1) Sell Order : exit the “Buy Order” after 3 bars Can anyone help ? Thanks Vasilis
v.trader  
#2 Posted : Saturday, January 30, 2010 9:37:40 AM(UTC)
v.trader

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/26/2009(UTC)
Posts: 76
Location: Toronto, Canada

Hi Vasilis, One way of doing that is to use the ValueWhen function. Following up on your example: Buy order: c>ref(c,-1) Sell order: BarsSince(ValueWhen(1,c>ref(c,-1),C))>3; However, there is a very big deficiency with the ValueWhen function that I know of and that is if the condition(c>ref(c,-1)) is repeated after you buy then the BarsSince function will count from the most recent occurrence of the expression c>ref(c,-1). This is the meaning of 1 in the Valuewhen syntax. If you put 2 for example, it will look not from the most recent occurence but from the one before that. That being said, if the condition of the buy order occurs rarely you can be quite comfortable with this sell expression. Maybe some of the more MetaStock - savvy guys on the forum can help you out further with more complex techniques. Cheers, VT
donpantits  
#3 Posted : Saturday, January 30, 2010 11:26:46 AM(UTC)
donpantits

Rank: Newbie

Groups: Registered, Registered Users
Joined: 1/30/2010(UTC)
Posts: 2

Thanks for your help VT, but is not working I just try it :) Must be some other way...
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.