Cancel Orders Commands
The cancel-related webhook commands (cancellong, cancelshort, cancelall, clearqueue) including the deprecated canceldelay alias.
Overview#
Cancel commands let you remove pending broker orders and queued platform signals without manual intervention in MetaTrader. There are two functionally distinct groups: broker-side cancellation (cancellong, cancelshort, cancelall), which instructs the EA to delete pending orders at the broker, and server-side queue cancellation (clearqueue), which removes signals you submitted with a delay timer before they fire. A fifth command, canceldelay, was renamed to clearqueue and now returns an error directing you to update your alerts.
Cancel commands also run regardless of Active Hours. The time filter gates entry signals only, so a cancel executes even outside the active window.
How It Works#
cancellong: Cancel pending buy orders#
When you send a cancellong signal for a symbol, the platform authenticates the request, queues it, and forwards it to the connected EA over WebSocket. The EA scans all pending orders on that symbol and deletes every BUY_LIMIT and BUY_STOP order that matches the magic number filter (if provided). Open long positions are not affected. The platform records the signal on receipt and updates the record with success or failure information once the EA acknowledges execution.
cancelshort: Cancel pending sell orders#
The flow mirrors cancellong, with the EA targeting SELL_LIMIT and SELL_STOP orders instead. Open short positions are not affected.
cancelall: Cancel all pending orders#
When a symbol is provided, the EA deletes all four pending order subtypes (BUY_LIMIT, BUY_STOP, SELL_LIMIT, SELL_STOP) for that symbol. In Multi-Strategy (multi-magic) mode a symbol-scoped cancelall REQUIRES a magic — sent without one it is rejected (it would otherwise cancel every strategy's pending orders on that symbol). When no symbol is provided, the command acts across every symbol and an explicit magic is honored: magic=N cancels only that strategy's pending orders on all symbols (a strategy-wide sweep), magic=0 targets only manual (magic-0) orders, and no magic at all (or magic=ALL) is the full kill switch that cancels every pending order on the terminal. The magic-less symbol-less form is the cross-strategy emergency brake and is exempt from the Multi-Strategy magic requirement. Open positions are not affected.
clearqueue: Cancel server-side delayed signals#
When you send clearqueue, the platform searches its own delayed signal queue for entries belonging to that license that have not yet fired. Matching entries are removed from the queue and will never be forwarded to the EA. No message reaches MT5, and no broker order is touched. This command is only meaningful if you previously sent signals with a delay= parameter. The platform returns a count of how many queued signals were removed.
clearqueue with a symbol: removes only queued signals for that symbol. A symbol-scoped magic-less clearqueue is rejected whenever the server cannot confirm the EA is in Single-Strategy mode. This covers Multi-Strategy mode, and also the brief window right after an EA (re)connects while its mode is still unknown to the server. The gate fails closed because clearqueue has no EA backstop (it would otherwise delete every strategy's queued signals on that symbol). In the unknown-mode case the alert response reads "...unless the EA is confirmed in Single-Strategy mode (its mode is not currently known to the server)" instead of "...in Multi-Strategy mode". Because clearqueue is a server-side action the EA never receives, this gate is enforced entirely on the server.
clearqueue without a symbol (or with ALL): removes all queued signals for the license, regardless of symbol — the cross-strategy emergency clear, exempt from the magic requirement.
canceldelay: Deprecated#
This command name was retired. Sending it now returns an immediate error with instructions to update the alert to use clearqueue instead. The behavior is identical to clearqueue. Only the name changed. See the error message table for the exact text shown.
Command Reference#
| Command | Symbol required? | What it cancels | Where it executes |
|---|---|---|---|
cancellong | Yes | Pending BUY_LIMIT and BUY_STOP orders | At the broker, via the EA |
cancelshort | Yes | Pending SELL_LIMIT and SELL_STOP orders | At the broker, via the EA |
cancelall | No (optional) | All pending orders of all types | At the broker, via the EA |
clearqueue | No (optional) | Queued delayed signals on the platform | On the platform server only |
canceldelay | N/A | Rejected; use clearqueue | N/A |
Format and Parameters#
CSV examples#
| Intent | Alert message |
|---|---|
| Cancel all pending buy orders on EURUSD | LICENSE_ID,cancellong,EURUSD |
| Cancel pending sell orders for one strategy | LICENSE_ID,cancelshort,EURUSD,magic=12345 |
| Cancel all pending orders on EURUSD | LICENSE_ID,cancelall,EURUSD |
| Cancel all pending orders on every symbol | LICENSE_ID,cancelall |
| Clear queued delayed signals for EURUSD | LICENSE_ID,clearqueue,EURUSD |
| Clear queued delayed signals for one strategy | LICENSE_ID,clearqueue,EURUSD,magic=12345 |
| Clear all queued delayed signals | LICENSE_ID,clearqueue |
JSON examples#
| Intent | Alert message |
|---|---|
| Cancel all pending buy orders on EURUSD | {"license":"LICENSE_ID","action":"cancellong","symbol":"EURUSD"} |
| Cancel pending sell orders for one strategy | {"license":"LICENSE_ID","action":"cancelshort","symbol":"EURUSD","magic":12345} |
| Cancel all pending orders on EURUSD | {"license":"LICENSE_ID","action":"cancelall","symbol":"EURUSD"} |
| Cancel all pending orders on every symbol | {"license":"LICENSE_ID","action":"cancelall"} |
| Clear all queued delayed signals | {"license":"LICENSE_ID","action":"clearqueue"} |
Parameters#
| Parameter | Commands | Required? | Notes |
|---|---|---|---|
symbol | cancellong, cancelshort | Yes | 1-20 uppercase alphanumeric characters. Lowercase is accepted and normalized automatically. |
symbol | cancelall, clearqueue | No | Omitting targets all symbols. |
magic | All | No | Integer or ALL. N restricts to that exact magic; ALL cancels every magic's orders (the wildcard); 0 targets only magic-0 (manual) orders. Negative values are rejected. Float values (e.g., 1.5) are silently truncated to the integer part, with no warning. |
User-Facing States#
| State | What It Means | Impact |
|---|---|---|
Signal received (ok) | The platform accepted and queued the signal for delivery to the EA. | For cancellong/cancelshort/cancelall: the EA will execute on next delivery. For clearqueue: queued signals have already been removed and a count is returned immediately. |
| Signal blocked | The signal passed format validation but was stopped by an auth password check. | No order is cancelled. Check your auth password configuration or remove the auth requirement. |
| Signal failed (partial cancel) | The EA executed the command but the broker rejected deletion of one or more matching orders. | Some orders were cancelled; others were not. Check the MetaTrader Experts tab for specifics. |
| Signal rejected | The signal failed format validation or was blocked before reaching the auth check. | Nothing was sent to the EA. The Signal Logs → Rejected Signals tab shows the reason. |
Error Messages and Meanings#
Surface A: Signal Logs → Rejected Signals tab + TradingView alert response#
These errors are returned as HTTP 400 from the webhook. TradingView displays the response body on the alert. The platform also logs the rejection to the Signal Logs → Rejected Signals tab, provided a valid license could be extracted from the payload. The rejection reason is stored verbatim (very long reasons may be shortened).
| Message | Cause | What to do |
|---|---|---|
Missing 'symbol' - signals require: license, action, symbol | cancellong or cancelshort was sent without a symbol field. | Add the symbol to the alert, for example LICENSE,cancellong,EURUSD. |
Invalid symbol 'X'. Symbols must be 1-20 uppercase alphanumeric characters (A-Z, 0-9). | The symbol contains spaces, slashes, dashes, or other disallowed characters. | Use only letters and numbers; no special characters. The symbol is automatically uppercased if sent in lowercase. |
canceldelay was renamed to 'clearqueue' for clarity. Update your TradingView alerts to use 'clearqueue' with the same parameters, same semantics, same symbol/magic filters. | The old canceldelay command name is no longer valid. | Edit the TradingView alert and replace canceldelay with clearqueue. No other changes are needed; the parameters are identical. |
Magic number required for [command] in Multi-Strategy mode. Add magic=N for one strategy, magic=ALL for a cross-magic sweep, or use cancelall. | The EA is running in Multi-Strategy mode and you sent cancellong or cancelshort without a magic= parameter. | Add magic=N to target one strategy, magic=ALL for a deliberate cross-magic sweep, or use cancelall. |
Magic number required for cancelall in Multi-Strategy mode. Add magic=N to cancel only your strategy's pending orders on this symbol, magic=ALL to cancel every strategy's pending orders on this symbol, or omit the symbol to cancel across all strategies and symbols. | The EA is running in Multi-Strategy mode and you sent a symbol-scoped cancelall without a magic= parameter. | Add magic=N or magic=ALL, or omit the symbol to use the cross-strategy emergency brake. |
Magic number required for clearqueue on [SYMBOL] in Multi-Strategy mode. Add magic=N to clear only your strategy's queued signals on this symbol, or omit the symbol for a cross-strategy clear. | The EA is running in Multi-Strategy mode and you sent a symbol-scoped clearqueue without a magic= parameter. | Add magic=N, or omit the symbol to clear every strategy's queued signals for the license. |
Surface B: TradingView alert response only (not logged to dashboard)#
These errors are returned as HTTP 401 or HTTP 429 from the webhook and shown on the TradingView alert response. They are not recorded as a row in the Signal Logs → Rejected Signals tab.
Cancel and close commands are deliberately exempt from the per-minute and daily signal rate limits: a kill switch can only reduce exposure, so it is never dropped for being over the cap. The only throttle that can shed a cancel is the redundant-sweep guard below, which fires only after the account is already flat.
| Message | Cause | What to do |
|---|---|---|
Authentication failed | The license key in the payload is unknown or has been deleted. An inactive or expired-trial license is deliberately allowed through for cancel and close commands, so it never surfaces here. | Verify the license ID in the TradingView alert matches exactly what appears in the dashboard. |
Too many cancel/close-all commands in a short window; the account is already flat. | cancellong, cancelshort, or cancelall was sent many times in quick succession. After the first sweep the account is already flat, so the redundant repeats are shed. | Space out repeated cancel sweeps. A single sweep already cancels every matching pending order, so retries are not needed. |
Surface C: Signal Logs → Rejected Signals tab (blocked signal row, HTTP 200 to TradingView)#
The platform returns HTTP 200 with status: blocked for these rejections, not a 4xx error. TradingView treats the alert as delivered. The block is recorded in the Signal Logs → Rejected Signals tab with the reason shown below.
| Reason shown | Cause | What to do |
|---|---|---|
Authentication required | The license has signal auth enabled but the alert payload did not include an auth password. | Add auth=PASSWORD to the TradingView alert, matching the password set in the license's auth settings. |
Invalid authentication | An auth password was provided but it does not match the one configured for the license. | Verify the auth password in the dashboard and update the TradingView alert to match. |
Authentication verification error | The platform encountered an internal error while verifying the auth password. | Retry the signal. If this recurs, contact support; this is a platform-side issue, not a configuration error. |
Surface D: MetaTrader Experts tab and EA support log#
These messages are generated by the EA after it receives the signal. They are not visible in the platform dashboard.
| Message | Cause | What to do |
|---|---|---|
Partial cancel: X of Y BUY orders deleted on [SYMBOL] | The EA matched Y pending buy orders but the broker only accepted deletion of X of them. | Check the MetaTrader Experts tab for broker-specific error codes. The undeleted orders may be in a transitional state (partially filled, being processed). Retry or handle manually in MT5. |
Partial cancel: X of Y SELL orders deleted on [SYMBOL] | Same as above, for sell orders. | Same as above. |
Partial cancelall: X of Y pending orders deleted on [SYMBOL] | Same as above, for a cancelall command. | Same as above. |
Where to look#
| Symptom | Primary surface to check |
|---|---|
| "My cancel alert says it fired in TradingView but nothing was cancelled" | Signal Logs → Rejected Signals tab; check for a blocked or rejected row with a reason |
| "TradingView shows an error response on the alert" | The error text in TradingView is the verbatim rejection reason; cross-reference with Surface A or B above |
| "The signal shows as received in the dashboard but orders weren't cancelled" | MetaTrader Experts tab and EA support log; look for a partial cancel or broker rejection message |
"I sent canceldelay and got an error" | Signal Logs → Rejected Signals tab; the reason includes the migration instruction to use clearqueue |
"clearqueue returned 0 but I thought I had delayed signals" | Verify the symbol and magic match the queued signals; confirm the delay timer has not already elapsed and the signal has not already fired |
| "My cancel signal shows as blocked" | Signal Logs → Rejected Signals tab; the row will show the auth block reason |
Plan and Tier Differences#
| Behavior | Trial | Standard | Pro | Premium |
|---|---|---|---|---|
cancellong / cancelshort / cancelall | Available | Available | Available | Available |
clearqueue | Available (always returns 0; delayed signals not permitted on Trial) | Available | Available | Available |
delay= parameter (prerequisite for clearqueue to have any effect) | Not permitted | Permitted | Permitted | Permitted |
| Maximum concurrent queued delayed signals | 0 | Standard plan limit | Pro plan limit | Premium plan limit |
When a subscription lapses, pending signals already in the queue are not automatically cleared; they will fire when their delay expires unless you send clearqueue before the timer elapses. Broker-side cancel commands (cancellong, cancelshort, cancelall) continue to function even when a license is inactive. This is a deliberate safety measure.
Known Edge Cases and Gotchas#
cancellongandcancelshortcancel pending orders only; they do not close open positions. To close open positions, usecloselong,closeshort, orcloseall.cancelallwithout a symbol and without a magic is a kill switch that targets every pending order across all symbols. Addingmagic=Nnarrows the sweep to that strategy's orders across all symbols. There is no confirmation step; the signal executes immediately on delivery.clearqueueand the broker-side cancel commands are independent. Sendingclearqueuedoes not affect already-delivered cancel signals at the broker, and vice versa.- A magic value of
0targets only orders with magic number 0 (manual orders) — it is a literal magic ID, not a wildcard. To cancel across every magic, usemagic=ALL. Negative magic values are rejected. - Float magic values (e.g.,
magic=1.5) are silently truncated to the integer part, with no warning. Typingmagic=1.5intendingmagic=2will target orders with magic 1. - Cancel commands always bypass symbol whitelist and blacklist filters. A symbol being "disabled" via
eaoffor excluded from the whitelist does not block cancel commands from executing. - Cancel commands are permitted even when a license is inactive or a subscription has lapsed. This is intentional.
- The Multi-Strategy magic rule is general, not
cancelall-specific: any symbol-scoped sweep (cancelall,closeall,closecancelall,closeallprofit,closeallloss, and symbol-scopedclearqueue) requires an explicitmagic=(N,0, orALL) in Multi-Strategy mode and is rejected without one, andcancellong/cancelshort(which always carry a symbol) require it too. The symbol-less form of each sweep is the exempt cross-strategy emergency brake: with no magic it sweeps everything, and withmagic=Nit is honored as a strategy-wide sweep across all symbols. The emergency shutdown pair (closealleaoff/closecancelalleaoff) is separate: always global, ignoring any symbol or magic (with a corrective note in the Experts tab). - If the EA is disconnected when a cancel signal arrives, the signal is held in the delivery queue and will execute when the EA reconnects. There is no timeout; broker-side cancel signals persist until delivered.
clearqueueis server-side only and does not require the EA to be connected. It executes and responds immediately regardless of EA status.- Partial cancel failures are not shown in the platform dashboard Signal Logs. A signal showing "received" in the dashboard may still have resulted in a partial cancel at the broker. The only surface where partial failure details appear is the MetaTrader Experts tab and EA support log.
Frequently Asked Questions#
Q: What is the difference between cancelall and clearqueue?
A: cancelall sends a command to the EA, which deletes matching pending orders from your MT5 terminal at the broker. clearqueue removes server-side delayed signals you submitted with a delay= parameter that haven't fired yet. They work on different systems: one affects your broker account, the other the platform's internal queue.
Q: I sent cancellong but the orders are still showing in MT5. What happened?
A: Check the Signal Logs → Rejected Signals tab first for a rejection reason. If the signal shows as received with no rejection, check the MetaTrader Experts tab for a partial cancel message from the EA. The most common causes are: the symbol didn't match any pending orders, the magic filter excluded all matches, or the broker rejected one or more deletions.
Q: I keep getting an error about canceldelay being renamed. How do I fix it?
A: Edit your TradingView alert and replace canceldelay with clearqueue in the message. The parameters are identical; no other changes are needed.
Q: Does cancelall close open positions too?
A: No. cancelall removes pending orders (limit and stop orders that haven't been triggered yet). It does not affect open positions. To close open trades, use closelong, closeshort, or closeall.
Q: Can I cancel orders for a specific strategy without affecting others?
A: Yes. Add magic=N to your cancel command, where N is the magic number assigned to that strategy. Only orders carrying that magic number will be cancelled. In Multi-Strategy mode, providing a magic number is required for cancellong and cancelshort.
Q: My clearqueue always returns 0. Why?
A: If you are on a Trial plan, delayed signals are not available; your queue is always empty. For paid plans, clearqueue returns 0 if there are no queued signals for that license, the delay timer already elapsed and the signal fired before clearqueue arrived, or a symbol or magic filter excluded all matches. Try sending clearqueue without any filters to target everything.
Q: Does a cancel command work if my license is inactive? A: Yes. Cancel and close commands are permitted even when a license is inactive or a subscription has lapsed. This is a deliberate safety measure so you can always clean up broker orders.
Q: What happens if I send cancelall to a symbol that has no pending orders?
A: The platform accepts the signal, the EA executes the command, finds zero matching orders, and reports success. Nothing is changed in MT5. The signal appears as received in Signal Logs with a cancel count of 0.