I have a strategy that can call EnterLongLimit and EnterSellLimit at the same and both orders will be outstanding until one of them is filled. I also call SetStopLoss and SetProfitTarget for both.
If my SellLimit order is filled, my stop and profit target are sent correctly, but what I'm noticing is that if my StopLoss for that sell is filled, my existing Limit order is cancelled.
From the logs, I'm short two contracts with a working LongLimit and I get the following two executions from my StopLoss. I see that Market Position is Long, which isn't correct at any point. The MarketPosition of Long could be what is cancelling my Existing Long Limits as I have some code to that effect, but I'm not sure why this is the case.
LOGS:
Execution='xxxxxxx' Instrument='xxx' Account='xxxx' Exchange=xxxx Price=1887.25 Quantity=1 Market position=Long
Execution='xxxxxxx' Instrument='xxx' Account='xxx' Exchange=xxx Price=1887.25 Quantity=1 Market position=Long
Can anyone help clarify what is happening or why my MarketPosition is thought to be LONG when it should be Short 1 on the first fill, Flat on the second fill?
Thank you !
Comment