GetAggregatedPL

GetAggregatedPL ( Symbol symbol );

Default values:

symbol: current symbol

Description

Returns the aggregated Profit/Loss (P/L) for a specified symbol, for the currently selected account and over a defined period. The Aggregated P/L is calculated as the difference between the current value of a position (based on the most recent MARK price) and the trade price of the position at the chart’s start point. It is adjusted for all trades that occurred during that period. 

Unlike GetOpenPL, which calculates real-time P/L on the open position, GetAggregatedPL provides historical P/L from a defined start point. 
 

Input Parameters

Parameter

Default value

Description

symbol

current symbol

Defines the instrument for which the aggregated profit/loss will be returned.

Example

declare lower;

def aggPL = GetAggregatedPL ();
plot AggregatedPL = aggPL;
AggregatedPL.AssignValueColor (if AggregatedPL >= 0 then Color.GREEN else Color.RED);

This script plots the aggregated profit/loss value of the current symbol using the selected aggregation period. The plot is colored green for positive values and red for negative ones.