I have been using the below syntax to get Unrealized profit for a specific position (in an indicator attached to Market Analyzer) and it works.
if (Instrument.FullName == position.Instrument.FullName) unRealizedPnL = position.GetUnrealizedProfitLoss(PerformanceUnit, Close.GetValueAt(CurrentBar));
if (Instrument.FullName == position.Instrument.FullName) RealizedPnL = position.GetRealizedProfitLoss(PerformanceUnit, Close.GetValueAt(CurrentBar));
Thanks
Comment