FXMT5 Bridge
Home › Guides › Alert message format

TradingView alert message format for MT5 (JSON)

The Message box of a TradingView alert tells MT5 Bridge what to do on your MetaTrader 5 account. It is a short piece of JSON: the action, the symbol, and optionally the size, stops and a strategy name.

Updated 23 October 2026

The simplest message

{"apikey": "YOUR_API_KEY", "action": "buy", "symbol": "EURUSD"}

That buys EURUSD at the market price with your account's default size. Your API key is on MT5 Accounts in the dashboard. Paste the message into the alert's Message box and the webhook URL https://mt5bridge.net/webhook into Notifications › Webhook URL (full set-up guide).

Every field

FieldWhat it doesAlso accepted as
apikeyRequired. Your account's API key: which MT5 account trades.api_key, key, secret, passphrase
actionRequired. What to do: see the actions below.
symbolRequired. The instrument, as your broker names it in MT5. A TradingView prefix such as OANDA: is removed for you.
quantitySize in lots, e.g. 0.10. Left out: your account's own sizing.qty, lots, lot, volume, size
slStop loss price.stop_loss, stoploss
tpTake profit price.take_profit, takeprofit
sl_pointsStop loss as a distance from the entry, in your broker's points (instead of a price).sl_pts
tp_pointsTake profit as a distance from the entry, in points.tp_pts
priceAn entry price: the buy or sell becomes a pending order that waits for it. Limit or stop is chosen for you from where the price is.entry, entry_price, limit_price
strategy_tagA name for the strategy, e.g. GOLD_SCALP. Written on the MT5 order, so your history keeps strategies apart.strategy, tag, comment
alert_idOptional ID, e.g. the bar time, so an alert re-sent for the same bar counts as a repeat.id, bar_time, time

Numbers may be written with or without quotes (0.10 or "0.10"), which helps when they come from TradingView placeholders.

Actions

ActionWhat happensAlso accepted
buyOpens (or adds to) a long position.long, enterlong
sellOpens (or adds to) a short position.short, entershort
closelongCloses the long positions on the symbol.exitlong, close_long
closeshortCloses the short positions on the symbol.exitshort, close_short
closeCloses everything on the symbol and cancels the bridge's pending orders there.exit, flat, close_all
cancellongDeletes the bridge's pending buy orders on the symbol.cancel_buy
cancelshortDeletes the bridge's pending sell orders on the symbol.cancel_sell
cancelDeletes all of the bridge's pending orders on the symbol. Open trades are not touched.cancel_all, delete

A close with a quantity closes only that much. With a strategy_tag, a cancel or close removes only the pending orders that tag placed.

On MT5 a sell does not close a buy. MetaTrader 5 accounts usually keep both sides open at once (hedging). To reverse a position, send closelong first and then sell, or use the Pine Script converter, which does this for you.

Examples

Buy gold with a stop loss and take profit

{"apikey": "YOUR_API_KEY", "action": "buy", "symbol": "XAUUSD", "quantity": 0.10,
 "sl": 2310, "tp": 2345, "strategy_tag": "GOLD_SCALP"}

Sell with stops in points

{"apikey": "YOUR_API_KEY", "action": "sell", "symbol": "EURUSD", "quantity": 0.20,
 "sl_points": 150, "tp_points": 300}

Close everything on a symbol

{"apikey": "YOUR_API_KEY", "action": "close", "symbol": "XAUUSD"}

A pending buy at a price

{"apikey": "YOUR_API_KEY", "action": "buy", "symbol": "GBPUSD", "quantity": 0.10,
 "price": 1.2650, "sl": 1.2600, "tp": 1.2750}

Using TradingView placeholders

{"apikey": "YOUR_API_KEY", "action": "{{strategy.order.action}}", "symbol": "{{ticker}}",
 "quantity": "{{strategy.order.contracts}}", "alert_id": "{{time}}"}

TradingView fills in the placeholders when the alert fires. {{strategy.order.action}} gives buy or sell for a strategy's orders.

Check what happened

Every alert that reaches the bridge is listed on Webhook Alerts in your dashboard with the result: the order and its ticket, or the reason it was refused (a wrong key, an unknown symbol, a lot size below the broker's minimum, or one of your own risk limits). The same alert sent twice within seconds is ignored.