The strategy happened to issue the closing order for a short position and the opening market order for a long position at the same time, because the conditions for both were met. However, instead of one long, this resulted in a position of two long contracts, one of them uncontrolled by the strategy and dangerously "on the loose". On investigating the log I found that the NT engine issued a "Close Position" order before my two orders were issued, hence three long orders.
Now, the only reason known to me why the NT engine would do something not unauthorized by a strategy is the Managed Approach. However, the only thing that the internal order handling would do, at least per the documentation, is preventing an order to be issued in certain cases, like for instance the one that occured with my strategy, which basically was an order to reverse the position. On the other hand, my opening order was a market order, and I did not get the usual Internal OrderHandling Violation message in the log. I hope someone can explain that "mystery" to me, and more importantly, how to prevent it from happening again.
Comment