Exit on Fixed Days
Author: rmccall
Creation Date: 3/30/2010 7:40 AM
profile picture

rmccall

#1
I am doing something wrong, but can't figure it out having tried several apporaches. I want to honor the exit strategy in place, but add an exit after "HoldDays"(fix number of bars) even if the exits in place have not fired. I either get a fixed number of days, or in this case, I have some trades that do not create an exit beyond the number of fixed days.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
Are you using IsLastPositionActive in a multi-position Strategy?
profile picture

rmccall

#3
OOPPSS!
profile picture

rmccall

#4
Hey Eugene,
I have configured for multiple positions and 2 conditions, but still get no trades. The logic should generate trades, but the coding is suspect. Can you look at it for me?
CODE:
Please log in to see this code.
profile picture

Eugene

#5
1. This condition is excessive (already looping by ActivePositions):
CODE:
Please log in to see this code.

2. With this condition, your exit logic would never trigger - the entry doesn't contain "Group1":
CODE:
Please log in to see this code.

And the problem was in putting the entry inside the ActivePositions loop - it didn't have a chance to trigger. Here's your code with all the changes and a little optimized:
CODE:
Please log in to see this code.