The Autoview trade language
One line describes one order. You or your agent write buy(BTCUSD, 0.2, -50), and the MCP command tool turns it into the Autoview alert command your exchange account runs, plus one plain sentence saying what it understood. A trader can read the line out loud. An agent can write it without guessing at parameter names.
The language is an open standard. The grammar is on this page and in the catalog tool's reply, so anyone can write it, generate it, or parse it in their own tools, prompts, and bots.
The sign rule: read this first
A sign means relative. No sign means an absolute price.
- On the entry price, a
+or-is an offset from the ticker. A number with no sign is the price itself. - On a bracket leg (take profit or stop loss), the sign is an offset from the entry. Legs always need a sign.
If you have written Autoview alerts by hand, this is the part that works differently. There is no p= or fp= to say which kind of number you mean. The sign does that job, so one missing minus changes the order completely:
| Line | What it means | Compiles to |
|---|---|---|
buy(BTCUSD, 0.2, -50) | Limit buy 50 below the ticker | s=BTCUSD b=buy t=limit q=0.2 p=-50 d=1 |
buy(BTCUSD, 0.2, 50) | Limit buy at a price of 50 | s=BTCUSD b=buy t=limit q=0.2 fp=50 d=1 |
buy(BTCUSD, 0.2, -0.5%) | Limit buy 0.5% below the ticker | s=BTCUSD b=buy t=limit q=0.2 p=-0.5% d=1 |
buy(BTCUSD, 0.2, 81000) | Limit buy at 81000 | s=BTCUSD b=buy t=limit q=0.2 fp=81000 d=1 |
The reply sentence tells the two apart: "limit at -50 from ticker" for the first line, "limit at 50" for the second. Check the sentence before you go live.
A few more things follow from the rule:
- A percent on a price is always an offset, so it needs a sign.
buy(BTCUSD, 0.2, 0.5%)is refused; write-0.5%or+0.5%. - A size never takes a sign.
0.2is an amount, and25%is a share of your balance. - A bracket leg without a sign is refused.
takeProfit(20)gets an error asking for an offset such astakeProfit(+20), so a missing sign can never quietly become a price. - A leg pointing the wrong way is refused too. On a buy, take profit sits above the entry, so
takeProfit(-20)gets "write +20, not -20".
The shape of a line
verb(symbol, size, price, words..., stop(trigger))
link(entry, takeProfit(offset), stopLoss(offset))The slots always come in the same order:
- symbol: the exchange's own symbol, written exactly as the exchange expects it, for example
BTCUSD. - size: an unsigned number (
0.2) or a share of balance (25%). - price: optional. No sign is an absolute price, a sign is an offset from the ticker, and leaving it out means at the ticker.
There is no key=value anywhere in a line. The shape of a value says what it is. A line like buy(BTCUSD, q=0.1) is refused with a pointer to the right form.
Five verbs
buyandsellopen orders.close(BTCUSD)closes the open position on a symbol.cancel(BTCUSD)cancels open orders on a symbol.closeandcanceltake an optionalbuyorsellfilter, for exampleclose(BTCUSD, sell).flat(BTCUSD)cancels every order and closes every position on the symbol, on exchanges that support it. Thesetuptool lists which ones do.
Order types
With no type word, an order is a limit at the ticker. That is the same default as a plain Autoview alert. Add a word after the price to change it:
market: a market order, no price.post: a post-only limit. Needs a price.ioc: an immediate-or-cancel limit. Needs a price.fok: a fill-or-kill limit. Needs a price.
For a stop entry, add stop(trigger). The trigger is an absolute price or a signed offset from the ticker. With no price, it is a stop market. With a price, it is a stop limit.
Brackets with link
link(entry, takeProfit(offset), stopLoss(offset)) attaches a take profit and a stop loss to a market entry. The legs take the entry's symbol and the opposite side, and each one covers the whole entry. Write the offsets from the entry in points (+500, -300) or in percent (+5%, -3%).
link(buy(BTCUSD, 0.2, market), takeProfit(+500), stopLoss(-300))
Dry run first, live by switch
Every line is a dry run by default. The compiled command carries d=1, the same Disabled flag a hand-written alert uses, so it previews in your log and places nothing. Going live is a switch on the tool call (live: true), never a word in the line, and it needs a live-scoped token from /account/tokens/. The same line always means the same order; only the switch decides whether it trades.
Verbs, words, and calls are case-insensitive. The symbol is passed through exactly as you wrote it.
Examples
| Line | Compiles to |
|---|---|
buy(BTCUSD, 0.2) | s=BTCUSD b=buy t=limit q=0.2 d=1 |
buy(BTCUSD, 0.2, 81000) | s=BTCUSD b=buy t=limit q=0.2 fp=81000 d=1 |
buy(BTCUSD, 0.2, -0.5%) | s=BTCUSD b=buy t=limit q=0.2 p=-0.5% d=1 |
buy(BTCUSD, 0.2, market) | s=BTCUSD b=buy t=market q=0.2 d=1 |
buy(BTCUSD, 0.2, 81000, post) | s=BTCUSD b=buy t=post q=0.2 fp=81000 d=1 |
buy(BTCUSD, 25%) | s=BTCUSD b=buy t=limit q=25% d=1 |
sell(BTCUSD, 0.2, stop(78000)) | s=BTCUSD b=sell t=market q=0.2 fpx=78000 d=1 |
sell(BTCUSD, 0.2, 77900, stop(78000)) | s=BTCUSD b=sell t=limit q=0.2 fp=77900 fpx=78000 d=1 |
close(BTCUSD) | s=BTCUSD c=position d=1 |
cancel(BTCUSD) | s=BTCUSD c=order d=1 |
link(buy(BTCUSD, 0.2, market), takeProfit(+500), stopLoss(-300)) | s=BTCUSD b=buy t=market q=0.2 d=1 & sl=300 tp=500 |
link(buy(BTCUSD, 0.2, market), takeProfit(+5%), stopLoss(-3%)) | s=BTCUSD b=buy t=market q=0.2 d=1 & sl=3% tp=5% |
In the bracket lines, the engine gets the distance without a sign and applies the side itself, which is why stopLoss(-300) becomes sl=300.
Using it from an agent
Pass the line to the command tool as line. The reply carries the compiled command and the sentence to confirm:
command({ line: "buy(BTCUSD, 0.2, -50)" })
{
"command": "s=BTCUSD b=buy t=limit q=0.2 p=-50 d=1",
"live": false,
"echo": "Buy 0.2 BTCUSD, limit at -50 from ticker. Dry run, not sent live.",
"line": "buy(BTCUSD, 0.2, -50)"
}Confirm the sentence, not the string. The command is the message any webhook sender delivers to your Autoview hook. An agent that has never seen this page can read the same grammar from the language field of the catalog tool's reply, with these examples included.
More forms are on the way. The catalog card always lists what the current version accepts.