Strategy functions have two Fill Bar constants, Strategy.THISBAR and Strategy.NEXTBAR. How to I close a position after n bars after a position was opened?
Announcement
Collapse
No announcement yet.
Strategy function
Collapse
X
-
dloomos:
Thank you for the suggestion. I tried it, and it does not work. I also tried getCurrentBarIndex(), and it does not work. What happens, if I want to close the position n=5 days after the position has been opened, the Analyzer counts n=5 buy signals after the original buy signal, and THEN closes the position. Which does not make sense.
I would expect that this issue should have been resoved a long time ago, and it is a matter of finding somebody who has developed a working a strategy which holds a position for several days.
dtrosty
Comment
-
dtrosty
Actually David's suggestion does work but you probably did not implement it correctly. Attached you can find an example showing what David suggested
You may also want to go through the EFS KnowledgeBase where you will find various guides on EFS including one on developing strategies.
AlexAttached Files
Comment
Comment