Skip to main content

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

ConceptDescription
OrderA single instruction to buy/sell
ExecutionA fill (partial or complete) of an order
TradeA complete lifecycle from entry to exit
PositionCurrent holdings (aggregate of open trades)

Trade Side

Trades have a side indicating the direction:

SideEntry OrderExit OrderProfit When
LongBuySellPrice rises
ShortSell (short)Buy (cover)Price falls

Trade Statuses

StatusMeaning
PendingTrade created, awaiting entry fill
OpenPosition is active
Partial CloseSome shares closed, rest still open
ClosedPosition fully closed
ExpiredClosed 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:

EffectMeaning
OpenIncreases position size
CloseDecreases 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:

  1. Open trade with initial quantity
  2. Send additional signal with same side
  3. UTM adds to the existing trade
  4. Average entry price recalculates

Scaling Out

Partially close a position:

  1. Send close signal with partial quantity
  2. Trade status changes to "Partial Close"
  3. Remaining quantity still open
  4. Realised P&L calculated on closed portion

Automatic Trade Management

From Signals

When a signal executes:

  1. UTM checks for existing open trade in same symbol/account
  2. If found, applies execution to existing trade
  3. 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

MetricDescription
Gross P&LProfit/loss before commissions
Net P&LProfit/loss after commissions
Return %Percentage return on entry value
DurationTime 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? (closeLong for long, closeShort for 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