Skip to content

πŸ—‘οΈ Cancel All Pending Orders (Alias)ΒΆ

Alias method: cancels all pending orders. Identical to closeAllPending() - provided for semantic clarity.

API Information:

  • Sugar method: MT5Sugar.cancelAll(String symbol, Boolean isBuy)
  • Underlying methods:
  • closeAllPending() - internally calls closeAllPending()
  • Source: MT5Sugar convenience layer

πŸ”½ InputΒΆ

Parameter Type Required Description
symbol String βšͺ Symbol name (null = all symbols)
isBuy Boolean βšͺ true=BUY orders, false=SELL orders, null=all

⬆️ OutputΒΆ

Returns: int - Number of pending orders successfully cancelled

Throws: ApiExceptionMT5 if operation fails


πŸ’¬ Just the essentialsΒΆ

  • What it is. Semantic alias for closeAllPending() - "cancel" is clearer than "close" for orders.
  • Identical to: closeAllPending(symbol, isBuy)
  • Use case. When you want clearer naming (cancel orders vs close positions).

πŸ”— Usage ExamplesΒΆ

1) Cancel all pending ordersΒΆ

int cancelled = sugar.cancelAll("EURUSD", null);

System.out.printf("βœ… Cancelled %d pending orders%n", cancelled);

See alsoΒΆ