How to sell x days after buy signal

KevinLed

Newbie
Messages
5
Likes
0
I want to set up an exploration where I say "sell 2 days after the buy signal," could somewone tell me how this is written? Thank you so much for your help. Kevin
 
I have used Metastock regularly for many years & I have written hundreds of explorations & done lots of work back testing, BUT, I do not see a way to say to sell so many days after the entry. For example, I can say buy when close goes above the 10 day moving average of close, & get out of the long when close moves below the 5 day moving average of close. Instead, I want to say go long when certain conditions are meet, & then get out of the position 2 days latter. Can someone tell me how to write sell the long x number of days latter. Thank you! Kevin
 
KevinLed said:
I have used Metastock regularly for many years & I have written hundreds of explorations & done lots of work back testing, BUT, I do not see a way to say to sell so many days after the entry. For example, I can say buy when close goes above the 10 day moving average of close, & get out of the long when close moves below the 5 day moving average of close. Instead, I want to say go long when certain conditions are meet, & then get out of the position 2 days latter. Can someone tell me how to write sell the long x number of days latter. Thank you! Kevin

Hi Kevin,
My MS is rusty, but here goes
Try calling your entry signal "n"
Now your sell signal after 2 days should be ref(n,-2) = 1
 
one workaround can be:
go to system editor>>edit>>stops>>inactive minimum change & set :
periods = 3 (No. of days after which you want to get out of your position)
Minimum change =99

Please note that this approach will fail if stock rises more than 99% in specified period of time (3 days in this case)

PS :my metastock version is 10.1
 
Top