MTContext Docs
Tool Reference

Analytics

5 tools in this category.

Overview

Analytics includes 5 tools for this workflow area.

Available tools: check_order, get_pnl_by_symbol, get_pnl_by_time, get_tick_history, get_trade_stats.

Use the parameter tables and examples below as the canonical request contract.

check_order

Checks whether an order can be placed without sending it. Supports both market and pending order types. Returns { feasible, required_margin, free_margin, estimated_cost, reason? }.

Parameters

NameTypeRequiredDefaultDescription
symbolstringYes
order_typestringYes(one of: BUY, SELL, BUY_LIMIT, BUY_STOP, SELL_LIMIT, SELL_STOP)
volumenumberYes
pricenumberNo

Example Request

{
  "tool": "check_order",
  "arguments": {
    "symbol": "EURUSD",
    "order_type": "BUY",
    "volume": 1
  }
}

get_pnl_by_symbol

Returns P&L broken down per trading symbol. Result: { items: [{ symbol, pnl, trades }] } sorted by |pnl| descending.

Parameters

NameTypeRequiredDefaultDescription
from_datestringNo
to_dateanyNo

Example Request

{
  "tool": "get_pnl_by_symbol",
  "arguments": {}
}

get_pnl_by_time

Returns P&L bucketed into time intervals. Result: { items: [{ period_start, pnl, trades }] } sorted chronologically.

Parameters

NameTypeRequiredDefaultDescription
periodstringNo"DAY"(one of: DAY, WEEK, MONTH)
from_datestringNo
to_dateanyNo

Example Request

{
  "tool": "get_pnl_by_time",
  "arguments": {}
}

get_tick_history

Returns a sequence of raw ticks for a symbol. Result: { ticks: [{ time, bid, ask, last, volume }] }.

Parameters

NameTypeRequiredDefaultDescription
symbolstringYes
countintegerNo100
from_datestringNo

Example Request

{
  "tool": "get_tick_history",
  "arguments": {
    "symbol": "EURUSD",
    "count": 100
  }
}

Usage Notes

  • Start with a smaller count/bars value while iterating, then increase once the workflow is stable.

get_trade_stats

Returns aggregate statistics over closed trades: total_trades, win/loss counts, win_rate, avg_profit, avg_loss, profit_factor, total_pnl, expectancy, max_drawdown_percent, sharpe_ratio, consistency_percent.

Parameters

NameTypeRequiredDefaultDescription
symbolstringNo
from_datestringNo
to_dateanyNo

Example Request

{
  "tool": "get_trade_stats",
  "arguments": {}
}

On this page