GetOrderTicket

Returns the ticket number of the currently selected order.

Syntax

GetOrderTicket(): number

Return Value

Returns a number representing the ticket number (unique identifier) of the currently selected order.

Description

The GetOrderTicket method returns the ticket number of the currently selected order. The ticket number is a unique identifier assigned to each order in the trading system. This number can be used with other methods like GetOrderDetails and GetExtendedOrderDetails to retrieve information about the order.

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 ticket to confirm
  const ticket = this.api.GetOrderTicket();

  console.log(`Selected order ticket: ${ticket}`);

  // Use the ticket with other methods
  const orderDetails = this.api.GetOrderDetails(ticket);
  console.log(`Order symbol: ${orderDetails.symbol}`);
}

Notes

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

Last updated