Exiting after N days in an intraday strategy
Author: 07nioe
Creation Date: 11/30/2016 7:06 PM
profile picture

07nioe

#1
I use the exit rule as described in the wiki.

http://www2.wealth-lab.com/WL5Wiki/kbSystemIntraday.ashx

As I use a MultiPositionCode the rule doesn't work as it should. Every time the entry role is true, the counter will be reset to zero. That means the position will be extended because the exit condition is false. But I don't want to extend the trade. How can I prevent the cnt variable to go back to zero as long as a certain position (e. g. Apple) is still active? Thank you for help.

Best
Niels

profile picture

Eugene

#2
Here's something for you to start with. It uses AddTradingDays from Community Components:

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

07nioe

#3
Cool, I will try it! Thanks Niels