What happens if a strategy issues a Buy order, but the order is not filled? (E.g., the price moves too quickly to allow a fill, or there is insufficient volume.)
The strategy is long, but there is no real position to match it. When the strategy Sells, will this create a short position? If so, this short position should not actually occur, since it would be out of synch with the strategy.
Is there a way to prevent this from occuring, and if so, can you provide an explanation of the mechanism or provide sample code that can detect and prevent this from happening?