I have a multi instrument strategy where I'm trying to track on each bar close, the current net PNL for the day to monitor the highs and lows (similar to MFE / MAE) across both closed positions and open positions. For example I need to be able to answer the question:
I understand I can iterate through my current open positions to get the unrealized PNL with something similar to the following:
Note: TradedSymbols is an internal collection I use to track every instrument I'm trading along with specific settings for that instrument and how it trades it.
double pnl = 0;
for (int i = 0; i < TradedSymbols.Count; i++)
{
pnl += Positions[i].GetUnrealizedProfitLoss(PerformanceUnit.Currency, Closes[i][0]);
}
SystemPerformance.AllTrades.TradesPerformance.Currency.CumProfit;

Comment