TradingView
Send TradingView alerts from Pine Script strategies and indicators to EZPZ Trader, with ready-to-paste alert messages.
On this page
Set up an alert
- Open the chart with your strategy or indicator and click Create alert.
- Choose the strategy or indicator as the Condition.
- Paste the JSON below into Message.
- On the Notifications tab, tick Webhook URL and paste your strategy's webhook URL.
- Click Create.
TradingView webhooks need a paid TradingView plan. TradingView replaces the {{…}} placeholders with real values when the alert fires.
Pine Script strategies
A strategy (its script starts with strategy() needs one alert per ticker that covers every order:
{
"ticker": "{{ticker}}",
"action": "{{strategy.order.action}}",
"sentiment": "{{strategy.market_position}}",
"quantity": "{{strategy.order.contracts}}",
"price": "{{close}}",
"time": "{{timenow}}",
"interval": "{{interval}}"
}
| Placeholder | Sends |
|---|---|
{{strategy.order.action}} |
buy or sell |
{{strategy.market_position}} |
long, short or flat: the position after the order. flat makes the order an exit. |
{{strategy.order.contracts}} |
The order's quantity |
{{close}} |
The price when the alert fired |
{{timenow}} |
The time the alert fired, used for signal age |
Strategies that reverse
When a strategy goes from long 5 to short 5 in one order, TradingView sends quantity 10. On the subscription, turn on Allow side swapping, allow signal quantity, and turn on Subtract exit quantity from signal quantity. EZPZ Trader then closes 5 and opens 5 short.
Pine Script indicators
An indicator (its script starts with indicator() needs a separate alert for each condition, each with its own message:
{
"ticker": "{{ticker}}",
"action": "buy",
"price": "{{close}}",
"time": "{{timenow}}"
}
Use "action": "sell" for the bearish condition, and "action": "exit" (or "sell" with "sentiment": "flat") for an exit-only condition.
Messages from Pine code
A script can build the message itself with alert_message in strategy.entry() / strategy.exit(), or alert(). Then put {{strategy.order.alert_message}} alone in the alert's Message box. The JSON the code builds must be valid; see Webhook Responses for the errors a broken message gets.
Ticker names
TradingView's {{ticker}} is usually right for stocks and crypto. For futures, TradingView's continuous symbols (NQ1!) aren't converted, so send the contract itself. See Futures Trading.
Limit to TradingView
On the strategy, set IP restriction to TradingView to refuse signals that don't come from TradingView's servers.
Things to know
- Alerts can be late. TradingView can deliver a webhook seconds, sometimes a minute, after the bar. Use Reject if signal is older than to skip stale ones, with
timein your message. - Check the Alert log. The Strategy Tester shows backtest trades, not what alerted. When a trade looks wrong, compare TradingView's Alert log with the strategy's Signals list.
- Repainting. A script that changes past signals on live bars backtests differently from how it alerts. Make sure your script doesn't repaint.
- One bar, two alerts. Avoid strategies that send an exit and a new entry in two separate alerts at the same moment. Send one reversing order instead.
↑ ↓ to move · Enter to open · Esc to close