With Ninja Script, I can see list of all buys and sells under Executions property.
The issue I am running into is how to match the sell executions with buy executions, which sell transaction corresponds to which buy transaction. I don't see any common ID or key that connects buys and sells.
I have tried looking for a purchase just prior to said sale that contains the same number of contracts, but this is not deterministic since, for example, an order with quantity 10 generates 10 purchase executions with quantity 1, for the 10 sales executions later I would always select the same purchase execution.
For the same reason, I think using Executions.OrderID is not deterministic either
Which is better way to link these executions using Executions property? How can I match the buy and sell executions using Executions property?
Thanks in advance!!
P.D.1: It looks like ID # 1993 or # 1994 suggestion are related with this!!
P.D.2: I'm using NinjaTrader 8
Comment