Trades
Trades represent complete trading cycles from entry to exit. UTM automatically creates and manages trades based on order executions.
Understanding Trades
A trade tracks a position from opening to closing:
Signal → Order → Execution → Trade Created
↓
More Executions (scaling in/out)
↓
Final Execution → Trade Closed
Trade vs Order vs Position
| Concept | Description |
|---|---|
| Order | A single instruction to buy/sell |
| Execution | A fill (partial or complete) of an order |
| Trade | A complete lifecycle from entry to exit |
| Position | Current holdings (aggregate of open trades) |
Trade Side
Trades have a side indicating the direction:
| Side | Entry Order | Exit Order | Profit When |
|---|---|---|---|
| Long | Buy | Sell | Price rises |
| Short | Sell (short) | Buy (cover) | Price falls |
Trade Statuses
| Status | Meaning |
|---|---|
| Pending | Trade created, awaiting entry fill |
| Open | Position is active |
| Partial Close | Some shares closed, rest still open |
| Closed | Position fully closed |
| Expired | Closed due to expiration rule |
Viewing Trades
Trades Page
Navigate to Trades to see all trades with filters:
- Status: Open, Closed, All
- Side: Long, Short, All
- Symbol: Filter by ticker
- Strategy: Filter by strategy
- Date Range: Entry date range
Trade Details
Click any trade to see:
- Entry: Orders and executions that opened the position
- Exit: Orders and executions that closed the position
- P&L: Realised profit/loss with breakdown
- Timeline: Complete history of events
- Related Signal: Original signal (if from automation)
- Strategy: Associated strategy (if any)
P&L Calculation
UTM calculates profit/loss based on trade side:
Long Trades
P&L = (Exit Price - Entry Price) × Quantity
Example: Buy 100 shares at $50, sell at $55
- P&L = ($55 - $50) × 100 = $500 profit
Short Trades
P&L = (Entry Price - Exit Price) × Quantity
Example: Short 100 shares at $55, cover at $50
- P&L = ($55 - $50) × 100 = $500 profit
Multiple Executions
For trades with multiple entries/exits, UTM uses average prices:
- Average Entry Price: Weighted average of all entry fills
- Average Exit Price: Weighted average of all exit fills
Position Effect
Each execution has a position effect:
| Effect | Meaning |
|---|---|
| Open | Increases position size |
| Close | Decreases position size |
This is determined automatically based on the order action and current position.
Scaling In and Out
Scaling In
Add to an existing position:
- Open trade with initial quantity
- Send additional signal with same side
- UTM adds to the existing trade
- Average entry price recalculates
Scaling Out
Partially close a position:
- Send close signal with partial quantity
- Trade status changes to "Partial Close"
- Remaining quantity still open
- Realised P&L calculated on closed portion
Automatic Trade Management
From Signals
When a signal executes:
- UTM checks for existing open trade in same symbol/account
- If found, applies execution to existing trade
- If not found, creates new trade
Exit Rules
Signals can include exit rules for automatic closing:
{
"action": "openLong",
"exitRule": {
"minutesBeforeClose": 0,
"orderType": "moc",
"timeInForce": "cls"
}
}
Exit rule timing options (mutually exclusive):
submitAt: Submit exit at specific time (HH:MM format, e.g., "15:30")minutesBeforeClose: Submit N minutes before market close (0-30)- Neither: Submit exit immediately when entry fills
When the entry fills, UTM automatically queues an exit signal.
Trade Analytics
Per-Trade Metrics
| Metric | Description |
|---|---|
| Gross P&L | Profit/loss before commissions |
| Net P&L | Profit/loss after commissions |
| Return % | Percentage return on entry value |
| Duration | Time from entry to exit |
Strategy Aggregation
Link trades to strategies for aggregate performance:
- Win rate
- Average win/loss
- Profit factor
- Maximum drawdown
See Strategies for details.
Common Issues
Trade Not Closing
Check:
- Is the close quantity equal to or less than open quantity?
- Is the close action correct? (
closeLongfor long,closeShortfor short) - Is the trade status still "Open"?
Wrong P&L
Verify:
- All executions are recorded (check execution history)
- Commission data is accurate
- No duplicate executions
Missing Trade
Trades are created when orders execute, not when submitted. Check:
- Order status (must be filled)
- Execution records exist
- Symbol and account match