Cancel Message Syntax
📐 Basic Rules
- Use Key=Value to set up instructions. Multiple keys can be separated by commas (,).
- Spacing around keys, values, or between multiple keys is not important.
- Keys are case-insensitive - upper or lower case does not matter.
- The order of Key=Value pairs is not important. You can arrange them in any order.
- Each action requires mandatory keys to be considered valid.
- Optional keys can be included to provide additional settings or data.
- Keys that are not supported by the action will be ignored.
- Maximum message length is 512 characters.
🔑 Supported Keys
| Key | Values | Example | Description |
|---|---|---|---|
| action* | Cancel | action=Cancel | Cancel action |
| ticket | number | ticket=4974331881 | Ticket filter |
| type | Buy, BuyStop, BuyLimit, BuyStopLimit, Sell, SellStop, SellLimit, SellStopLimit | type=Buy; type=Sell | Order type filter |
| symbol | text | symbol=GBPUSD | Order symbol filter |
Keys that marked with * are mandatory keys. Missing any of mandatory keys will make the message invalid
💡 Explanation
action
Use this key to define the trade action you want to perform. This is mandatory key.
For canceling pending orders, use action=Cancel
ticket
Use this key to filter orders by ticket.
When ticket is used, don't use other filters as it has no meaning.
Message:
action=Cancel, ticket=4974331881
Result:
The pending order with ticket number = 4974331881 will be canceled.
type
Use this key to filter orders by type.
Valid type values are as below:
- Buy - All Buy orders (BuyStop, BuyLimit, BuyStopLimit)
- BuyStop - Buy stop orders
- BuyLimit - Buy limit orders
- BuyStopLimit - Buy stop-limit orders
- Sell - All Sell orders (SellStop, SellLimit, SellStopLimit)
- SellStop - Sell stop orders
- SellLimit - Sell limit orders
- SellStopLimit - Sell stop-limit orders
Please aware that some order types (such as BuyStopLimit or SellStopLimit) are not supported in MT4.
Message:
action=Cancel, type=Buy
Result:
All pending buy orders (BuyStop, BuyLimit, BuyStopLimit) will be canceled.
symbol
Use this key to filter orders by symbol.
Our symbol-mapping feature helps you here in some cases. For more details, please read in Buy/Sell syntax
Message:
action=Cancel, symbol=EURUSD
Result:
All pending orders for the EURUSD symbol will be canceled.
🆗 Examples
Example #1
action=cancel, type=buylimit
Explanation
- Cancel pending orders
- Process on all symbols with type is Buy Limit
Example #2
action=cancel, symbol=EURUSD, type=sell
Explanation
- Cancel pending orders
- Process on EURUSD symbol with type is Sell