GetOrderOpenTime

Returns the opening time of the currently selected order.

Syntax

GetOrderOpenTime(): TDateTime

Return Value

Returns a TDateTime value representing the opening time of the selected order.

Description

The GetOrderOpenTime method returns the date and time when the currently selected order was opened. The time is returned as a TDateTime value, which represents the number of days since December 30, 1899.

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 the order's opening time
  const openTime = this.api.GetOrderOpenTime();
  // Get current time
  const currentTime = this.api.TimeCurrent();

  // Calculate how long the order has been open (in days)
  const daysOpen = currentTime - openTime;
  console.log(`Order has been open for ${daysOpen.toFixed(2)} days`);
}

Notes

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

Last updated