etrink← Home

How to Send a TradingView Webhook to MetaTrader 5

Last updated: July 2026

TradingView alerts are excellent at telling you when to act — but they never place a real order. An alert is just a notification. To turn "buy EURUSD" into an actual position on MetaTrader 5, something has to receive that alert and execute it on your broker. Normally that means a PC or VPS running 24/7. This guide shows you how to connect TradingView to MT5 with a webhook, and how etrink runs the whole thing for you — no computer, no VPS.

What a TradingView webhook is

A webhook is just a URL that TradingView calls the moment your alert fires. Instead of only showing a popup or sending an email, TradingView performs an HTTP POST to an address you provide, with a message body you define. That message can be plain text or, far more usefully, JSON — a structured payload a program can read and act on.

So the webhook itself is not "trading". It is a one-way messenger: "this condition just happened, here is the data." Something on the other end has to listen for that message and decide what to do with it.

Why you need something to receive it

TradingView will happily send the webhook, but it has no connection to your broker. The receiver is the piece that matters. It must:

  • Be online 24/7 — markets and alerts don't wait for your laptop to wake up.
  • Authenticate the request, so a leaked URL can't drain your account.
  • Translate the JSON into a real MetaTrader 5 order (symbol, side, volume, stops).
  • Handle rejections gracefully — wrong symbol name, invalid stop level, volume over the limit.

You can self-host that receiver on a VPS with an EA bridge, but you own the uptime, the crashes and the security. etrink is the hosted alternative: a validated webhook endpoint plus the EtrinkAgent that runs your MT5 terminal in the cloud, so your automation keeps running even when your machine is off.

Step-by-step: TradingView alert → MetaTrader 5 order

  1. Create your key. In the etrink panel open Webhook, choose the MT5 account to bind, and click + New key. Copy the URL shown once:
https://api.etrink.com/hooks/etrk_xxxxxxxxxxxxxxxx
  1. Create the alert in TradingView. Open any chart, add an alert (the alarm-clock icon), and set your condition — a crossover, an indicator level, or a strategy signal.
  2. Enable Webhook URL. In the alert's Notifications tab, tick Webhook URL and paste the etrink URL above. (A paid TradingView plan is required for webhooks.)
  3. Set the message. Paste the JSON payload (next section) into the alert's Message field.
  4. Save and test. When the condition triggers, TradingView POSTs to etrink, the request is validated, and the order is executed on your bound account. Every signal is logged in your panel.

The full field reference lives in the webhook docs.

The alert message format (JSON)

The simplest possible market buy looks like this. Put it straight into TradingView's Message box:

{
  "action": "buy",
  "symbol": "EURUSD",
  "volume": 0.01,
  "sl": 0,
  "tp": 0
}

Here sl:0 and tp:0 mean no stops — the order opens with no stop-loss or take-profit attached. That's the safest default while you're testing, because a badly placed stop is the most common reason a broker rejects an order.

When you're ready to attach stops, remember the direction rule: for a buy, the stop-loss must sit below the current price and the take-profit above it (reversed for a sell). Invalid ordering is rejected by the broker, not by etrink:

{
  "action": "buy",
  "symbol": "EURUSD",
  "volume": 0.01,
  "sl": 1.0820,
  "tp": 1.0920
}

A sell is symmetrical, and volume is optional if you set a default per account:

{ "action": "sell", "symbol": "XAUUSD", "volume": 0.05 }

You can also let TradingView fill in values at send time using its placeholders. It replaces {{ticker}}, {{strategy.order.action}} and {{close}} just before the POST:

{ "action": "{{strategy.order.action}}", "symbol": "{{ticker}}", "volume": 0.01 }

Pine Script example

If you drive signals from a strategy, use the alert() call inside your Pine code so the exact JSON message is sent when your conditions are met:

//@version=5
strategy("etrink signal", overlay=true)

fast = ta.sma(close, 10)
slow = ta.sma(close, 30)

if ta.crossover(fast, slow)
    strategy.entry("Long", strategy.long)
    alert('{"action":"buy","symbol":"EURUSD","volume":0.01,"sl":0,"tp":0}',
          alert.freq_once_per_bar_close)

if ta.crossunder(fast, slow)
    strategy.close("Long")
    alert('{"action":"close","symbol":"EURUSD"}',
          alert.freq_once_per_bar_close)

Two SMAs cross up, a long opens and the buy JSON is sent; they cross down, the position closes. Using alert.freq_once_per_bar_close avoids firing repeatedly inside a forming candle — a frequent cause of duplicate orders.

Common problems (invalid stops, symbol names, volume)

  • Symbol name mismatch. Your broker may list EURUSD as EURUSD.m, EURUSD.pro or similar. If the symbol in your JSON doesn't match exactly, the order can't be found. Check the exact name in MetaTrader 5's Market Watch.
  • Invalid stop levels. A stop-loss above price on a buy (or below on a sell) is rejected. Stops must also respect the broker's minimum distance ("stops level") from the current price.
  • Volume rejected. Too small, too large, or the wrong step (e.g. 0.013 when the broker only allows 0.01 increments). etrink also applies your per-account volume limit — lower the volume or raise the limit.
  • Duplicate fills. If an alert fires on every tick instead of on bar close, you'll open many positions. Set the alert frequency to Once Per Bar Close.

FAQ

Do I need a VPS or to keep my PC on?

No. TradingView sends the webhook from its own servers, and etrink hosts the MT5 side. Your machine can be off.

Is a paid TradingView plan required?

Webhook URLs are a paid TradingView feature, so yes for the alert side. The MT5 execution is handled by etrink.

Can I test without risking money?

Yes — add "test": true to any message and all validation runs but no real order is placed. See the docs for details.

Can I automate this programmatically?

If you'd rather drive etrink from an AI assistant or your own tooling, our MCP integration exposes the same actions.

Keep your webhook URL secret. Anyone holding it can place orders on the bound account. If it leaks, rotate the key from your panel immediately.

Start free — create an account, connect TradingView to MT5 and run your first automated alert on the free trial in minutes. Questions? [email protected]