etrink← Home

TradingView Webhook Integration

Last updated: October 2026

Turn your TradingView alerts into live orders automatically. When your alert fires, TradingView sends a webhook to etrink, and our EtrinkAgent executes the buy/sell on your MT5 account — 24/7, even while your computer is off.

How it works

TradingView alert → etrink webhook (validates key, symbol & volume limits) → command queue → EtrinkAgent on your MT5 terminal → your broker. Every signal is logged in your panel.

Step-by-step setup

  1. In your panel open Webhook, pick the account to bind, and click + New key.
  2. Copy the webhook URL shown once (keep it secret — it can place orders):
https://api.etrink.com/hooks/etrk_xxxxxxxxxxxxxxxx
  1. In TradingView, create an Alert. Enable Webhook URL and paste the URL above.
  2. Paste the JSON below into the alert Message field:
{
  "action": "buy",
  "symbol": "EURUSD",
  "volume": 0.01,
  "sl": 0,
  "tp": 0,
  "id": "{{time}}"
}
  1. Save. When the alert triggers, the order is executed on your bound account.

Message format

FieldRequiredDescription
actionyesbuy · sell · close. close only closes — it never opens a new order.
symbolyesBroker symbol (e.g. EURUSD, XAUUSD)
volumenoLot size. Required for buy/sell; subject to your per-account volume limit.
sl / tpnoStop-loss / take-profit price (0 = none)
magicnoMT5 magic number (integer ≥ 0) of the order — use one per strategy. On close, only positions with this magic are closed; without it, every position of the symbol is closed.
closeOppositenotrue = before opening, close the opposite side on the same symbol (a buy closes the sells, a sell closes the buys); only positions with the same magic if magic is set. If the opposite side can't be closed, the new order is not opened.
allowDuplicatenoDefault true. false = don't open a new order while a position in the same direction (with the same magic, if set) is already open on the symbol. The signal shows as skipped in your panel — not an error. With closeOpposite, the opposite side is closed first, then this check runs.
commentnoComment written to the opened order in MT5. Max 31 characters are used; Turkish letters become Latin (ç → c), quotes and emoji are removed.
idnoIdempotency key — the same id is never executed twice
testnotrue = validate only, no real order

Alternative spellings are accepted too: close_opposite, closeopposite, magicNumber, magic_number, allow_duplicate — and string values such as "true", "false" or "1001".

Examples

Sell

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

Close an open position

{ "action": "close", "symbol": "EURUSD" }

Close only one strategy's positions (magic)

{ "action": "close", "symbol": "XAUUSD", "magic": 1001 }

Dynamic values (TradingView placeholders)

TradingView replaces {{ticker}}, {{strategy.order.action}}, {{close}} and more at send time:

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

Strategy reverse (one alert for long and short)

A single strategy alert follows your chart on MT5: when the strategy goes long, the sells of magic 1001 are closed and a buy is opened; when it goes short, the opposite. A second position in the same direction is never opened.

{
  "action": "{{strategy.order.action}}",
  "symbol": "{{ticker}}",
  "volume": 0.01,
  "magic": 1001,
  "closeOpposite": true,
  "allowDuplicate": false,
  "comment": "TV strateji A",
  "id": "{{timenow}}"
}

Pine Script example

Use the alert() call so the message (your JSON) is sent to the webhook when 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}',
          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)

Test safely

Add "test": true to any message (or use the Test signal button in the panel). All checks run, the event is logged as test, but no real order is placed.

Security & reliability. A key can be bound to a single account, so its signals only affect that account. If that account is stopped, the next incoming signal automatically restarts it — so your automation keeps running. Never share your webhook URL.

Troubleshooting

  • “symbol not allowed” — the symbol isn't in your allow-list, or the name differs at your broker (e.g. EURUSD.m).
  • “no running instance” — the bound account is stopped; it will auto-restart, then resend.
  • Volume rejected — above your per-account limit; lower the volume or raise the limit.
  • Signal “skipped” — allowDuplicate: false and a position in the same direction was already open; expected behaviour.
  • Every call appears on the Signals page of your panel with its status, result (ticket or error) and the raw JSON — check there first.

Need help? [email protected]