GetCurrentProfit

Description

The GetCurrentProfit method retrieves the current floating profit or loss of the trading account. This value represents the difference between the current equity and the initial deposit, showing how much money has been gained or lost in the trading session.

Syntax

public GetCurrentProfit(): number

Return Value

Returns a number representing the current profit or loss. A positive value indicates profit, while a negative value indicates loss.

Example

const profit = this.api.GetCurrentProfit()
if (profit > 0) {
    console.log(`Current profit: ${profit}`)
} else {
    console.log(`Current loss: ${Math.abs(profit)}`)
}

Last updated