Error after closing Position in a multi-position strategy
Author: dowen
Creation Date: 1/25/2019 8:58 PM
profile picture

dowen

#1
Using manual tracking to control number of positions. It appears after I close a position, then I get an error as my position list changed and that is not allowed in C#. Is that the issue and I have to use technique described in "Close positions on different bars in a MP Strategy"


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

Eugene

#2
1. First of all, it's advised that you don't mix same bar AtStop/AtLimit entries and exits. As this FAQ implies (and suggests a workaround), this isn't realistic: I want to test a strategy that buys and sells with stop/limit orders on the same bar.

2. For CoverAt* exits, I think you wanted to say "p.AutoProfitLevel * 0.99" (instead of 1.01).

3. Before trying to refer to a Position by an index the way you're doing, make sure the index is not out of bounds.
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).