[FONT=Calibri][SIZE=3]OnOrderUpdate(IOrder order)[/SIZE][/FONT]
[FONT=Calibri][SIZE=3]{[/SIZE][/FONT]
[SIZE=3][FONT=Calibri] // after verifying this is the order I think it is…[/FONT][/SIZE]
[COLOR=blue][FONT=Courier New] if[/FONT][/COLOR][COLOR=black][FONT=Courier New](order.OrderState == OrderState.Filled)[/FONT][/COLOR]
[COLOR=black][FONT=Courier New] {[/FONT][/COLOR]
[COLOR=black][FONT=Courier New] Trade lastTrade = Performance.AllTrades[[/FONT][/COLOR][COLOR=purple][FONT=Courier New]0[/FONT][/COLOR][COLOR=black][FONT=Courier New]]; [/FONT][/COLOR]
[COLOR=black][FONT=Courier New] tradePL += lastTrade.ProfitCurrency * lastTrade.Quantity; [/FONT][/COLOR]
[COLOR=black][FONT=Courier New] }[/FONT][/COLOR]
[COLOR=black][FONT=Courier New]}[/FONT][/COLOR]
When the OnOrderUpdate() message fires, I would assume the collection would already know about the trade that just caused the OnOrderUpdate() message. Is this correct?
I am just trying to keep a running total of my winners and lossers - both realtime and historic. I've simplified the code above for clarity - much more is happening after the P/L for the trade is calculated.
Thanks,
-Scott

Comment