GetOrderOpenPrice

Returns the open price of the currently selected order.

Syntax

GetOrderOpenPrice(): number

Return Value

Returns a number representing the open price of the selected order.

Description

The GetOrderOpenPrice method returns the price at which the currently selected order was opened. This is the price at which the trade was executed when the position was established.

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

Example

// Select an order by ticket number
if (this.api.SelectOrder(12345, EOrderSelectMode.SELECT_ORDER_BY_TICKET)) {
  // Get the order open price
  const openPrice = this.api.GetOrderOpenPrice();

  console.log(`Order #12345 open price: ${openPrice}`);
}

Notes

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

Last updated