fx-chartingDocs
Trading

Trade events (onTradeEvent)

One callback for everything that happens to orders and positions.

js
<FxChart
  onTradeEvent={(e) => {
    // e.event: "placed" | "opened" | "closed" | "cancelled" | "modified"
    analytics.track("trade", e);
    if (e.event === "closed") saveToJournal(e);
  }}
/>
Event
{
  "event": "closed",
  "ticket": "917328817",
  "ticker": "EURUSD",
  "side": "buy",
  "type": "market",
  "lots": 0.1,
  "price": 1.08523,
  "sl": 1.08323,
  "tp": 1.08723,
  "close": 1.08721,
  "profit": 19.8,
  "reason": "tp",
  "time": "2026-10-12T10:41:08.000Z"
}

reason on closes: "sl", "tp" or "manual". The same object is what trade webhooks send.