GetOrderCommission

Returns the commission fee for the currently selected order.

Syntax

GetOrderCommission(): number

Return Value

Returns a number representing the commission fee for the selected order.

Description

The GetOrderCommission method returns the commission fee that was charged for the currently selected 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 details
  const commission = this.api.GetOrderCommission();
  const volume = this.api.GetOrderVolume();

  // Calculate commission per lot
  const commissionPerLot = volume > 0 ? commission / volume : 0;

  console.log(`Order #12345 commission: ${commission.toFixed(2)}`);
  console.log(`Commission per lot: ${commissionPerLot.toFixed(2)}`);
}

Last updated