GetPortfolioAggregatedPL ();
Description
Returns the aggregated Profit/Loss (P/L) value for all positions in the account within the currently selected chart timeframe. This value represents the cumulative difference between the current market value and the initial trade price of all positions opened during the chart’s time interval.
The calculation considers all instruments in the portfolio and reflects realized and unrealized profit/loss values.
Example
declare upper;
plot TotalPL = GetPortfolioAggregatedPL();
TotaPL.AssignValueColor(if Total PL >= 0 then Color.UPTICK else Color.DOWNTICK);
This script displays the aggregated P/L of the portfolio over the selected chart timeframe. Gains are plotted in green, losses in red.