GetOrderComment

Returns the comment attached to the currently selected order.

Syntax

GetOrderComment(): string

Return Value

Returns a string containing the comment attached to the selected order.

Description

The GetOrderComment method returns the comment text that was attached to the order when it was created or modified. Order comments can be used to store additional information about the trade, such as execution reasons, strategy identifiers, or any other relevant notes.

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 comment
  const comment = this.api.GetOrderComment();

  console.log(`Order #12345 comment: ${comment}`);
}

Notes

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

Last updated