On this page (6)
What you need
- A TradingView plan that includes webhook notifications. These sit on TradingView's paid plans, so check yours on their site.
- A connected trading account — MT4, MT5, cTrader, Tradovate or NinjaTrader — for the alert to trade on.
- A paid plan here: signal execution, TradingView included, is on Starter and above.
There is no TradingView login to connect, and nothing is installed on your machine.
Create the instance
- Click + New instance and choose TradingView under Where do the trades come from?
- Give the setup a name under ALERT LABEL — for example the strategy and symbol — and click Choose destinations →.
- Select the one account the alert should trade on. One alert posts to one webhook URL, so a TradingView instance fires into one account. Click Configure →.
- Set the sizing and risk settings and click Create and activate.
- The last screen shows WEBHOOK URL — PASTE INTO TRADINGVIEW. Click COPY.
Later, TUNE on the instance has COPY WEBHOOK URL. The address carries a token that identifies your instance, so keep it private.
Set up the alert in TradingView
Create the alert on your indicator or strategy as usual. In its notifications, tick Webhook URL and paste the address. In the alert's message box, put one line of JSON — the examples below. TradingView's placeholders such as {{ticker}} and {{close}} fill in the chart's symbol and price when the alert fires.
Opening a trade
{"symbol":"{{ticker}}","side":"buy","entry":{{close}},"sl":2375,"tp":[2390,2400]}- symbol — the instrument. side —
buyorsell. - entry, sl and tp — the entry price, the stop and the targets. Stop and target are optional: leave them out and the instance's own settings decide. One target can be written as a bare number instead of a list. Prices must be numbers, not text in quotes.
- orderType —
market(the default),limitorstop.
To get in at a better price, or on a break, name the order type and the price:
{"symbol":"{{ticker}}","side":"buy","orderType":"limit","entry":2380,"sl":2375}
{"symbol":"{{ticker}}","side":"buy","orderType":"stop","entry":2395,"sl":2375}A limit or stop is placed as a real working order and waits for the price; it is never filled at whatever is trading when the alert lands. The size comes from the instance's settings — the account's balance and the distance to the stop — never from the alert.
Closing a trade
A close names no side and no prices:
{"action":"close","symbol":"{{ticker}}"}
{"action":"close_long","symbol":"{{ticker}}"}
{"action":"close_short","symbol":"{{ticker}}"}
{"action":"close","symbol":"{{ticker}}","percent":50}
{"action":"close"}- A plain close closes what this instance has open on that instrument and cancels any entry still waiting for it.
- close_long and close_short do the same for one direction only.
- percent, from 1 to 100, takes that share off each open position and leaves waiting entries alone. A position too small to divide at that share is closed in full, and the log says so.
- close with no symbol does the same for everything the instance is holding — what a strategy's flatten condition wants.
Positions you opened yourself, or that another instance opened, are never touched. On a futures account the instrument is matched on the contract root, so an alert on a continuous chart closes the dated contract that was actually traded.
When an alert does nothing
- Check the instance's log in the Cockpit: every alert taken, held or skipped is there with its reason. See Why a copy was held or skipped.
- A message that isn't valid JSON, or has no symbol and side (or close action), is refused when it arrives.
- A Tradovate or NinjaTrader account needs a contract rule for the instrument first: see Futures contract mapping.