close position X days later
Author: asurapan
Creation Date: 6/27/2012 8:37 PM
profile picture

asurapan

#1
what is the best way to go about closing a position X days after entry?

I am using the following code but when I optimize it only goes to 5 days.
CODE:
Please log in to see this code.


I am thinking that instead specifying in the code that places the trade, that I should do something like:
if "bars since entered" = delay, then Cover.

Ultimately I'd like to see how a strategy works simply by selling X days after a particular setup. (perhaps 1-20 days)
profile picture

Eugene

#2
This is a no-no. The "bar" here should be either "bar" or "bar+1" and should not exceed "bar+1" at any rate.

Here's how:
CODE:
Please log in to see this code.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).