I would like to associate to one unique Trade, an entry and exit orders when using SubmitOrder (I have Unmanaged = true). At the moment my executed entries and exits are associated to different trades.
For the entry I have 2 OCO orders, 1 buy and 1 sell:
For example if the long is executed first, then the ShortSell is cancelled.
Or if the ShortSell is executed First then the Long order is cancelled.
Then in OnExecution method,
if the Long was executed first I create a Sell order which is the corresponding exit.
If the ShortSell (entry) was executed I create a BuyToCover order (exit).
Even if the couple of Long and Sell orders are given the same exact name (or the couple of ShortSell and BuyTo Cover), I see they are not associated to the same Trade.
I would like basically these couples to be associated to the same Trade.
How can I achieve this?
Thanks for your help
Comment