Thanks for your answer, the way You suggested is accepted.
1. FIFO made.
2. by Accounts. I find an easy way to get this PnL without additions/subtractions, etc.
************************************************** ***** ***************
in on if (State == State.SetDefaults) { lock (Account.All) myAccount = Account.All.FirstOrDefault(a => a.Name == "Sim101"); realPnLAllTradesOnCloseOrder = myAccount.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar); } in override void OnExecutionUpdate(....) { var lastTrade = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1]; var comulativePnLCurrentIntstrument = SystemPerformance.AllTrades.TradesPerformance.NetProfit; realPnLAllTradesOnCloseOrder += lastTrade.ProfitCurrency; //"Total" can be also to get in the onBarUpdate() }
Leave a comment: