Skip to content

Get Trade History

read-only · idempotent

View recently closed trades with P&L, duration, close reason, and optional aggregate statistics.

Returns trades from the in-memory ring buffer (up to 200 most recent).

NOTE: Only tracks positions closed through this MCP server session. Trades closed via cTrader UI or other tools are not captured. History resets on server restart. Use the journal (trades.jsonl) for persistent records.

PARAMETERS:

  • symbol: Optional filter by symbol (e.g., “EURUSD”). Omit for all trades.
  • limit: Number of most recent trades to return (1-200, default 20).
  • includeStats: When true, includes aggregate statistics: win rate, profit factor, average win/loss, best/worst trade, per-symbol breakdown.

RESPONSE FIELDS (per trade):

  • positionId, symbol, side (BUY/SELL)
  • volume, entryPrice, exitPrice, realizedPnL (in USD), realizedPnLRaw (in quote currency)
  • quoteCurrency, pnlCurrency, conversionRate (rawPnL × rate = usdPnL)
  • openedAt, closedAt (ISO 8601), durationMs
  • closeReason: STOP_LOSS, TAKE_PROFIT, MANUAL, CLOSE_ALL, OCO, UNKNOWN
  • closingClOrdId: the order that closed the position
  • linkedOrders: snapshot of SL/TP orders that were active at close time

STATISTICS (when includeStats=true):

  • totalTrades, winningTrades, losingTrades, breakeven
  • winRate (0.0–1.0), totalPnL, avgWin, avgLoss
  • profitFactor (gross wins / gross losses, Infinity if no losses)
  • bestTrade, worstTrade (positionId + symbol + pnl)
  • avgDurationMs
  • bySymbol: per-symbol trades, pnl, winRate

This is a read-only operation with no risk checks.

ParameterTypeRequiredDescription
symbolstringNoFilter by symbol (e.g., ‘EURUSD’). Omit for all.
limitnumberNoNumber of most recent trades to return (1-200, default 20). Default: 20.
includeStatsbooleanNoInclude aggregate statistics (win rate, P&L, profit factor). Default: false.