oco - OCO Order Monitoring
Monitor existing orders and automatically cancel competing orders when one fills.
What is oco?
oco monitors a group of EXISTING orders on the exchange. When ANY order in the group fills, closes, or is cancelled, flipr.cloud automatically cancels ALL other orders in that group.
Key Difference from sl-or-tp
sl-or-tp CREATES both TP and SL orders, then monitors them.oco FINDS existing orders you already placed, then monitors them.
Use oco when you manually place individual orders and want OCO logic applied.
Perfect For:
Manually placed TP + SL orders that need OCO monitoring
Multiple entry orders where only one should fill
Complex bracket orders with multiple exit levels
Critical Limitation
oco can only monitor orders that are ALREADY PLACED on the exchange.
- Works with:
limit,stop(immediately placed) - Doesn't work with: Trailing orders (only placed when trigger hits)
Syntax
oco all|buy|sell|long|short|session
oco #tagParameters
scopeRequiredType: keyword or tag | Default: all
Which orders to monitor. The list is determined ONCE at the start:
| Syntax | Orders Monitored |
|---|---|
oco all | All open orders for this symbol |
oco buy or oco long | All open buy/long orders only |
oco sell or oco short | All open sell/short orders only |
oco session | Only orders created in this webhook |
oco #tag | Orders with specific tag |
Real-World Examples
1. Manual TP + SL with OCO Monitoring
Place individual TP and SL orders, then monitor them with OCO logic.
BTCUSDT on My_API_Key
// Clean slate
rem all
pos 0
// Enter position
market long 0.01
// Manually place TP and SL
limit short 100%p off e5% reduce
stoploss short 100%p off e2%
// Monitor them with OCO logic
oco sellWhen the TP limit fills OR the SL stop triggers, the other order is automatically cancelled.
2. Multiple Entry Levels (Only One Should Fill)
Place 3 limit buy orders at different levels, but you only want ONE to fill.
ETHUSDT on My_API_Key
// Place 3 entry limits
limit long 0.3 off 1%
limit long 0.3 off 2%
limit long 0.3 off 3%
// Cancel others when one fills
oco buyAs soon as any buy order fills, the other two are cancelled. This prevents accumulating too large a position.
3. Tagged Order Groups
Monitor only specific tagged orders, leaving others alone.
BTCUSDT on My_API_Key
// Primary exit orders (tagged)
limit short 50%p off e3% reduce #primary
stoploss short 50%p off e1.5% #primary
// Secondary exit orders (different tag)
limit short 100%p off e8% reduce #secondary
// Monitor only primary group
oco #primaryOnly primary orders (3% TP, 1.5% SL) have OCO logic. Secondary 8% TP order remains independent.
4. Session Orders Only
Monitor only orders created in THIS webhook, ignore old orders.
BTCUSDT on My_API_Key
// Don't cancel old orders
// Place new TP/SL for this entry
market long 0.01
limit short 100%p off e4% reduce
stoploss short 100%p off e2%
// Monitor only these 2 new orders
oco sessionoco session ensures old orders from previous signals aren't affected.
When to Use oco
| Situation | Best Command |
|---|---|
| Simple TP + SL after entry | sl-or-tp (easier!) |
| Custom TP/SL with specific settings | oco |
| Multiple entry levels (one should fill) | oco |
| Scaled exits with partial fills | oco |
| Bracket orders on entry | oco |
Best Practices
Place orders BEFORE calling oco - OCO monitoring starts immediately, so orders must exist first
Use tags for complex setups - Tag related orders to monitor specific groups independently
Use oco session for safety - Prevents interfering with old orders from previous signals
Prefer sl-or-tp for simple cases - It's easier and creates+monitors in one step
How OCO Monitoring Works
The oco command starts monitoring orders. Implementation depends on exchange support:
| Exchange | Native OCO | Notes |
|---|---|---|
| Binance | Yes | Native GTE_GTC OCO orders |
| ByBit | Yes | Native position TP/SL linking |
| BitMEX | Yes | Native OCO via clOrdLinkID |
| Others | Flipr.Cloud | Flipr.Cloud monitors orders (~1s polling) |
For exchanges without native OCO, Flipr.Cloud's OCO Monitor polls order status and cancels remaining orders when one fills. Use reset-oco to clear monitoring groups if needed.
Related Commands
sl-or-tp- Easier TP+SL with automatic OCO (creates orders for you)
smart-oco- Position-aware monitoring (cancels on position close/flip)
reset-oco- Clear OCO monitoring groups
rem- Manually cancel orders