rem / cancel - Cancel Open Orders
Cancel pending orders to clean up before opening new positions or manage existing orders.
What is rem / cancel?
rem (or cancel) removes open orders from the exchange. It only affects orders on the symbol in your webhook (e.g., if your webhook is for BTCUSDT, it will only cancel BTCUSDT orders). Both commands are aliases.
Common Use Cases:
Clean Slate Strategy
Cancel all orders at the start of your webhook to ensure fresh state
Timed Order Cleanup
Place order, wait for time to pass, then cancel if not filled
Strategic Order Management
Cancel only buy orders, only sell orders, or specific tagged orders
Symbol Scope
rem only affects orders for the current symbol. If your webhook is for BTCUSDT on My_API_Key, it will only cancel BTCUSDT orders, not orders on other symbols like ETHUSDT.
Toobit Limitations
Toobit has API limitations for cancel commands:
rem all,rem buy,rem sell- Work correctly✗
rem tp,rem sl,rem tpsl- Not supported✗
rem #tag- Not supported
Native TP/SL are attached to the position and will be automatically removed when the position is closed.
Bitget Limitations
Bitget does not support cancelling TP/SL:
rem all,rem buy,rem sell- Work correctly✗
rem tp,rem sl,rem tpsl- Not supported
Native TP/SL are attached to the position and will be automatically removed when the position is closed.
Syntax
rem all|buy|sell|long|short|session
rem tp|sl|tpsl
rem limit|market|stop|entry
rem #tag
// 'cancel' is an alias for 'rem'
cancel all|buy|sell|long|short|session
cancel tp|sl|tpsl
cancel #tagParameters
scopeRequiredType: keyword or tag | Default: session
Determines which orders to cancel:
| Syntax | What Gets Cancelled |
|---|---|
rem all | ALL open orders for this symbol on the exchange |
rem buy or rem long | All open buy/long orders only |
rem sell or rem short | All open sell/short orders only |
rem session | Only orders created in this webhook execution |
rem tp or rem takeprofit | Only take profit orders |
rem sl or rem stoploss | Only stop loss orders |
rem tpsl or rem sl-tp | Both TP and SL orders with atomic cancellation (OCO-aware) |
rem limit | Only limit orders |
rem market | Only market orders (rarely useful since market orders execute instantly) |
rem stop | Only stop orders (stop-market or stop-limit) |
rem entry | Only entry orders (non-reduce-only orders) |
rem #tag | Only orders with the specified tag |
Real-World Examples
1. Clean Slate - Cancel Everything Before Trading
Most common pattern: cancel all existing orders and close position before starting fresh.
BTCUSDT on My_API_Key
// Clear everything
rem all
pos 0
// Now start fresh
market long 0.01
sl-or-tp short 100%p sl off 2% tp off 5%This ensures no old orders interfere with your new strategy. Best practice for most strategies.
2. Timed Order - Cancel if Not Filled
Place a limit order, wait 30 minutes, then cancel it if it hasn't filled yet.
BTCUSDT on My_API_Key
// Place limit order with tag
limit long 50% off 1% #entryOrder
// Wait 30 minutes
wait 30m
// Cancel if not filled
rem #entryOrderIf the limit order fills before 30 minutes, there's nothing to cancel. If it's still pending, it gets cancelled.
3. Cancel Only Buy Orders
Cancel buy orders while keeping sell orders active (useful when switching strategy direction).
ETHUSDT on My_API_Key
// Cancel all pending buy orders
rem buy
// Keep sell orders, add new short entry
market short 0.5This is useful when you had buy orders waiting but now want to go short instead.
4. Session Orders Only
Cancel only orders created in this webhook execution, leaving older orders untouched.
BTCUSDT on My_API_Key
// Place multiple orders
limit long 25% off 1%
limit long 25% off 2%
limit long 25% off 3%
// Later: cancel only these 3 orders
wait 1h
rem sessionrem session only affects orders created in THIS webhook run, not old orders from previous signals.
5. Tagged Order Groups
Create multiple order groups with tags, then cancel specific groups independently.
BTCUSDT on My_API_Key
// Entry orders group
limit long 25% off 1% #entries
limit long 25% off 2% #entries
// Exit orders group
limit short 50% off -3% #exits
limit short 50% off -5% #exits
// Later: cancel only entry orders
wait 15m
rem #entriesTags let you organize orders into logical groups and manage them independently. Very powerful for complex strategies.
Best Practices
Start webhooks with rem all - Ensures clean state, prevents orphaned orders
Use tags for complex strategies - Label order groups to manage them independently
Combine with wait - Place orders, wait for fill time, cancel if not executed
Cancel before reversing direction -
rem buybefore going short
Common Patterns
Strategy Reset
rem all
pos 0Clears all orders and closes position - fresh start
Timed Entry
limit long 50% off 1% #entry
wait 30m
rem #entryWait for fill, cancel if not executed within time
Direction Switch
rem buy
market short 0.01Cancel buys, go short - useful for trend reversals
Related Commands
oco- Automatic OCO monitoring for competing orders
wait- Pause before cancelling orders
limit- Create orders that can be tagged for later cancellation