> For the complete documentation index, see [llms.txt](https://docs.metacopier.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metacopier.io/ai/ai/trading.md).

# Trading with AI

The assistant can place, modify and close trades. This page explains exactly what it can do, what it cannot do, and how to keep it in check.

{% hint style="danger" %}
Trading tools act on **live accounts with real money**. An assistant can misread an instruction, a symbol name or a volume. Never enable trading on an account you are not prepared to see traded.
{% endhint %}

***

## Enabling it

Trading is off unless four things are true at the same time:

1. The connection uses a **read write** credential. A `READ_ONLY` API key can never trade.
2. On OAuth, the scope **`mcp:trading.write`** was approved. Without it every trading endpoint is refused, even when configuration writes are allowed.
3. The endpoint includes the **`trading`** toolset and is not a `/readonly` endpoint.
4. The project has **100 accounts or fewer**. See [large projects are read only](/ai/ai/security.md#large-projects-are-read-only).

Example of a connection that may trade on one specific project:

```
https://ai.metacopier.io/p/{projectId}/mcp/x/trading
```

{% hint style="info" %}
The refusal happens on MetaCopier's side, not in the assistant. Even if a model decided to try, an endpoint it has no scope for answers with an error.
{% endhint %}

***

## The five trading tools

<table><thead><tr><th width="300">Tool</th><th>What it does</th></tr></thead><tbody><tr><td><code>metacopier_open_position</code></td><td>Opens a position, or places a pending order, and waits for the broker to answer. The result tells you whether it worked.</td></tr><tr><td><code>metacopier_send_order</code></td><td>The same, but returns immediately without waiting. Faster, and it does <strong>not</strong> confirm that the trade was executed.</td></tr><tr><td><code>metacopier_modify_position</code></td><td>Changes the stop loss, take profit, volume or pending price of an existing position or order.</td></tr><tr><td><code>metacopier_close_position</code></td><td>Closes one position, or cancels one pending order.</td></tr><tr><td><code>metacopier_close_all_positions</code></td><td>Closes everything open on one account, and cancels its pending orders.</td></tr></tbody></table>

All five are marked **destructive** in the protocol, which is the signal most hosts use to ask you to confirm before the call goes out. Whether you actually get that confirmation dialog depends on your client, so treat it as a helpful extra and not as your safety net.

***

## Parameters

### Opening a position or sending an order

<table><thead><tr><th width="220">Parameter</th><th width="100" align="center">Required</th><th>Meaning</th></tr></thead><tbody><tr><td><code>accountId</code></td><td align="center">yes</td><td>The account to trade on</td></tr><tr><td><code>symbol</code></td><td align="center">yes</td><td>The symbol as the broker spells it, for example <code>EURUSD</code> or <code>ETHUSD</code></td></tr><tr><td><code>orderType</code></td><td align="center">yes</td><td><code>Buy</code>, <code>Sell</code>, <code>BuyLimit</code>, <code>SellLimit</code>, <code>BuyStop</code> or <code>SellStop</code></td></tr><tr><td><code>volume</code></td><td align="center">yes</td><td>Size in <strong>lots</strong>, for example <code>0.1</code></td></tr><tr><td><code>openPrice</code></td><td align="center">no</td><td>Required for the four pending types. Left out on a market order, which fills at the current price.</td></tr><tr><td><code>stopLoss</code></td><td align="center">no</td><td>Price, or points when <code>relativeTpSl</code> is set. Omit or <code>0</code> for none.</td></tr><tr><td><code>takeProfit</code></td><td align="center">no</td><td>Same as above</td></tr><tr><td><code>relativeTpSl</code></td><td align="center">no</td><td>When true, stop loss and take profit are read as a distance in points from the fill price instead of an absolute price</td></tr><tr><td><code>pendingExpirySeconds</code></td><td align="center">no</td><td>How long a pending order stays alive. MT4 and MT5 only, and the broker decides whether it accepts it.</td></tr><tr><td><code>comment</code></td><td align="center">no</td><td>A short note on the trade. Keep it under roughly 23 characters, the rest is cut off.</td></tr></tbody></table>

### Modifying

`accountId` and `positionId` are required. Everything you pass of `stopLoss`, `takeProfit`, `volume` and `openPrice` is changed, everything you leave out stays as it is.

### Closing

`accountId` and `positionId` are required. `pendingOnly` restricts the call to cancelling an unfilled order, so a filled position is left alone.

***

## Things worth knowing before you let it trade

### Copiers still apply

A trade the assistant opens on a **master account**, meaning an account whose trades are copied to its follower accounts, is copied exactly like any other trade. "Buy 0.1 lots of EURUSD" on a master is not one trade, it is one trade per follower, sized by each copier's settings.

{% hint style="warning" %}
Before you ask for a trade, ask the assistant what the account is: "Is this account a master, and which accounts follow it?" It has the tools to answer.
{% endhint %}

### Send order does not confirm anything

`metacopier_send_order` returns as soon as the request is on its way. A rejection by the broker, an invalid volume or a closed market surfaces later in the account log, not in the answer you see. Prefer `metacopier_open_position` unless speed genuinely matters, and check the logs afterwards.

### Close all is per account

`metacopier_close_all_positions` closes everything on **one** account. It does not close the whole project. If the account is a master, the closes are copied to its followers as usual.

### Symbols are the broker's

Brokers name the same instrument differently: `EURUSD`, `EURUSD.m`, `EURUSD_i`. The assistant can list the symbols an account actually has, and it should, rather than guess. If a trade is refused with an unknown symbol, that is usually why.

### Request ids

Every order carries a request id so that a repeated network attempt cannot become a second trade. This is handled for you, there is nothing to configure.

***

## Recommended way to work

1. Start with a **read only** connection and get used to what the assistant sees and how it reasons.
2. Move to a connection that has `trading` but only on a **demo project or a demo account** while you learn its habits.
3. When you go live, keep trading on its own connection, for example `/p/{projectId}/mcp/x/trading`, separate from the connection you use for everyday questions. A conversation about copier settings then has no way to place an order at all.
4. Always name the account explicitly in your instruction, and read back what the assistant says it is about to do before you confirm.

{% hint style="success" %}
A good habit: ask for a plan first. "Do not trade yet. Tell me exactly which order you would send, on which account, and with what stop." Then confirm.
{% endhint %}
