GetUnrealizedProfitLoss()
GetUnrealizedProfitLoss()
Definition
Calculates the unrealized PnL for the account position.
Method Return Value
A double value representing the account’s unrealized PnL.
Syntax
PositionAccount.GetUnrealizedProfitLoss(PerformanceUnit unit, [double price])
- If no double argument is provided in the call, the current (real-time) Last price will be substituted in. In case Tools > Options > Trading > ‘Use last price for Pnl’ is unchecked or the instrument type is Forex / CFD the bid (for a long position) / ask (for a short position) would be used as a substitute.
- For back-testing a double price to compare against should be provided like in our example below.

