GetOrderClosePrice

Returns the close price of the currently selected order.

Syntax

GetOrderClosePrice(): number

Return Value

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

Description

The GetOrderClosePrice method returns the price at which the currently selected order was closed. For active (open) orders, this value is not relevant.

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

Example

// Select a historical order by ticket number
if (this.api.SelectOrder(12345, EOrderSelectMode.SELECT_ORDER_BY_TICKET)) {
  // Get the order close price
  const closePrice = this.api.GetOrderClosePrice();

  console.log(`Order #12345 close price: ${closePrice}`);
}

Notes

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

  • This method is primarily useful for historical orders that have been closed.

Last updated