Smart Orders
Advanced order management with multiple take-profit targets, trailing stop loss, break-even automation, and OCO logic — all managed server-side for reliability.
During the BETA period, Smart Orders are available with paper trading. Live trading support will be enabled in a future release. Smart Orders require a PRO subscription tier or above.
What Are Smart Orders?
Smart Orders go beyond basic limit and stop orders. They bundle multiple exit strategies into a single managed order that the server monitors and executes automatically:
Smart Order Features
Multiple Take-Profit Levels
Define several TP targets at different prices, each with its own size allocation percentage
Trailing Stop Loss
A dynamic stop that follows the price upward (for longs) using a configurable callback rate
Break-Even Auto-Stop
Automatically moves your stop loss to the entry price once the first TP level is filled
OCO Logic
One-Cancels-Other — when the stop loss triggers, all remaining TP orders are cancelled, and vice versa
Crash Recovery
Order state is persisted to the database. On server restart, all active orders are automatically recovered and monitoring resumes
Real-Time Updates
WebSocket events push state changes instantly to the UI — no polling required
Multi-TP Targets
Define multiple take-profit levels to scale out of a position gradually, locking in profits at each stage:
Setting Up Multi-TP Levels
Create a Smart Order
Specify the symbol, side (BUY/SELL), entry price, and total quantity.
Add TP Levels
Define each take-profit target with: - **Price**: The trigger price for this TP level - **Size %**: The percentage of remaining quantity to close at this level (all levels should sum to 100%)
Monitor Progress
Each TP level shows a status indicator: - Grey dot — **PENDING**: Not yet triggered - Yellow dot — **TRIGGERED**: Price reached, exchange order placed - Green dot — **FILLED**: Successfully executed - Red dot — **CANCELLED**: Cancelled (e.g., by SL trigger or manual cancel)
Track Completion
The TP progress indicator shows filled/total (e.g., 2/3) so you can see at a glance how far your exit plan has progressed.
Example: 3-Level TP Strategy
| TP Level | Price | Size % | Purpose |
|---|---|---|---|
| TP1 | $105 | 40% | Lock in early profits |
| TP2 | $110 | 35% | Capture the main move |
| TP3 | $120 | 25% | Let the runner ride |
A common approach is to allocate a larger percentage to TP1 (40-50%) to secure quick profits, then distribute the remainder across higher targets. Combine with break-even to protect the remaining position after TP1 fills.
Trailing Stop Loss
A trailing stop dynamically adjusts the stop price as the market moves in your favor, protecting profits while allowing the trade to run:
The trailing stop tracks a high-water mark — the highest price reached since the order became active (for long positions):
- You set a callback rate (e.g., 2%)
- The server monitors the price via TickerCache every 500ms
- As price rises, the high-water mark updates and the stop price follows: stop = highWaterMark * (1 - callbackRate)
- If price drops below the current stop price, the stop loss triggers
For example, with a 2% callback rate on a long position:
- Entry at $100, initial high-water mark = $100, stop = $98
- Price rises to $110, high-water mark = $110, stop = $107.80
- Price drops to $107, triggers the trailing stop
Break-Even Auto-Stop
When enabled, break-even automatically moves your stop loss to the entry price once the first take-profit level is filled:
Automatic Protection
Once TP1 fills, your stop loss moves to entry — you can no longer lose on the remaining position
Zero-Risk Runner
After break-even activates, all subsequent TP levels are pure profit with no downside risk
Toggle On/Off
Enable or disable break-even at any time, even on active orders, via the modify dialog
Status Tracking
The order state shows whether break-even has been triggered, so you always know your risk status
Break-even works best when your TP1 is conservatively placed to ensure it fills frequently. If TP1 is too far from entry, you may get stopped out before break-even activates.
OCO (One-Cancels-Other)
Smart Orders implement OCO logic server-side to prevent conflicting exit orders:
| Scenario | Action |
|---|---|
| Stop loss triggers | All remaining TP levels are cancelled |
| All TP levels fill | Stop loss is cancelled |
| Trailing stop triggers | All remaining TP levels are cancelled |
| Manual cancel | All TP levels and SL are cancelled |
This ensures you never have orphaned orders sitting on the exchange after a position is fully closed.
Crash Recovery
Smart Orders are designed for reliability. Every state change is persisted to the database using optimistic locking (version numbers prevent concurrent modification conflicts):
Recovery Process
Persistent State
Every smart order's state — TP levels, SL price, trailing high-water mark, break-even status — is written to PostgreSQL on each update.
Server Restart
On startup, the executor queries all orders in ACTIVE or PARTIALLY_CLOSED state from the database.
Resume Monitoring
Recovered orders are loaded into the in-memory evaluation loop. Trailing stop high-water marks are restored from the last persisted value.
No Lost Orders
Bull queue jobs use unique job IDs per trigger event, preventing duplicate execution even if a trigger fires just before a restart.
Order Lifecycle
A smart order progresses through these states:
| State | Description |
|---|---|
| PENDING | Order created, waiting to become active |
| ACTIVE | Monitoring price for TP/SL/trailing triggers |
| PARTIALLY_CLOSED | One or more TP levels filled, remaining quantity still monitored |
| CLOSED | All TP levels filled or fully exited — order complete |
| STOPPED | Stop loss or trailing stop triggered — position closed |
Managing Smart Orders
The Smart Orders panel in the Trading Terminal provides full order management:
View All Orders
See all active, partially closed, and completed orders with real-time state updates via WebSocket
Modify Orders
Update stop loss price, trailing callback rate, or toggle break-even on active orders
Cancel Orders
Cancel any active order with a confirmation dialog — all associated TP/SL orders are cleaned up via OCO
TP Progress
Visual progress indicator shows filled vs total TP levels with color-coded status dots
Supported Exchanges
Smart Orders work with all exchanges that support the Trading Terminal:
- Binance, Bybit, OKX, Gate.io, Bitget, KuCoin, Kraken, Coinbase
Smart Orders require a connected exchange API key. The server places real orders on the exchange when triggers fire. Ensure your API key has trading permissions enabled.