As a specific event occurs (for example the closing price of a bar crosses a certain price point) I want to enter a position (say 10 long). The strategy is not to do anything until that position has been reached. How do I ensure that the target position is reached no matter what?
Running a test on a 1 tick chart on FDAX 09-07 I had some weird things happen. If I only call EnterLong() on the initial bar I sometimes got my order cancelled partially filled. If I resubmit until the target position is reached I sometimes got errors or overfill depending on if I called the function again with the target quantity or the target quantity minus the current MarketPosition.Quantity.
The problems seemed to happen at random, but were much less frequent on slower moving markets.
I am sure I must be doing something wrong, but I am just not sure what. Therefore my question.
Comment