GetOrderProfitInPips

Returns the profit of the currently selected order in pips.

Syntax

GetOrderProfitInPips(): number

Return Value

Returns a number representing the profit of the selected order in pips.

Description

The GetOrderProfitInPips method returns the profit or loss of the currently selected order measured in pips. This provides a standardized measure of profit/loss regardless of the currency pair's price scale.

Before using this method, you must first select an order using the SelectOrder method.

Example

// Select an order by its ticket number
if (this.api.SelectOrder(12345, EOrderSelectMode.SELECT_ORDER_BY_TICKET)) {
  // Get profit in pips
  const profitInPips = this.api.GetOrderProfitInPips();

  console.log(`Order profit: ${profitInPips} pips`);

  // Use profit in pips for decision making
  if (profitInPips > 20) {
    console.log("Order has reached target profit in pips");
  } else if (profitInPips < -10) {
    console.log("Order has exceeded maximum loss in pips");
  }
}

Notes

  • An order must be selected first using SelectOrder before calling this method.

  • Positive values indicate profit, negative values indicate loss.

  • Pips are calculated based on the specific currency pair's characteristics.

  • This method is particularly useful for standardized risk management and performance tracking.

Last updated