MTContext Docs
Tool Reference

Order Management

3 tools in this category.

Overview

Order Management includes 3 tools for this workflow area.

Available tools: cancel_order, modify_pending_order, partial_close.

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

cancel_order

Cancels a pending (limit or stop) order by ticket. Defaults to dry_run=true — set dry_run=false to execute live. Returns ORDER_NOT_FOUND if the ticket is not in pending orders. Requires the trade capability and inp_AllowTrading=true on the EA.

This tool can affect a live trading account. dry_run defaults to true — pass dry_run: false explicitly to execute for real.

Parameters

NameTypeRequiredDefaultDescription
ticketintegerYes
dry_runbooleanNotrue

Example Request

{
  "tool": "cancel_order",
  "arguments": {
    "ticket": 123456,
    "dry_run": true
  }
}

Usage Notes

  • Keep dry_run: true until you have validated symbol, lot size, and expected execution behavior.

modify_pending_order

Modifies the price, stop_loss, take_profit, or expiry of a pending (not-yet-filled) order. Distinct from modify_position (trading.ts), which adjusts stop_loss/take_profit on an already-open position — use this tool for a ticket still showing in get_orders, that one for a ticket in get_positions. At least one of price, stop_loss, take_profit, or expiry must be provided. Defaults to dry_run=true — set dry_run=false to execute live. Requires the trade capability and inp_AllowTrading=true on the EA.

This tool can affect a live trading account. dry_run defaults to true — pass dry_run: false explicitly to execute for real.

Parameters

NameTypeRequiredDefaultDescription
ticketintegerYes
pricenumberNo
stop_lossnumberNo
take_profitnumberNo
expiryintegerNo
dry_runbooleanNotrue

Example Request

{
  "tool": "modify_pending_order",
  "arguments": {
    "ticket": 123456,
    "dry_run": true
  }
}

Usage Notes

  • Keep dry_run: true until you have validated symbol, lot size, and expected execution behavior.

partial_close

Closes a portion of an open position. volume must be less than the full position volume. Defaults to dry_run=true — set dry_run=false to execute live. Returns INVALID_PARAMETER if volume >= position volume, POSITION_NOT_FOUND if position closed between dry-run and live call. Requires the trade capability and inp_AllowTrading=true on the EA.

This tool can affect a live trading account. dry_run defaults to true — pass dry_run: false explicitly to execute for real.

Parameters

NameTypeRequiredDefaultDescription
ticketintegerYes
volumenumberYes
dry_runbooleanNotrue

Example Request

{
  "tool": "partial_close",
  "arguments": {
    "ticket": 123456,
    "volume": 1,
    "dry_run": true
  }
}

Usage Notes

  • Keep dry_run: true until you have validated symbol, lot size, and expected execution behavior.

On this page