TradingView alerts: the complete guide
A TradingView alert watches a condition on your chart — a price, an indicator, a strategy — and notifies you the moment it is met. This guide covers the whole chain: creating the alert, choosing its frequency and expiry, writing the message with TradingView's variables, then having it executed on MT4, MT5 or cTrader.
The alert message
{
"action": "buy",
"symbol": "EURUSD",
"volume": 0.10,
"sl": 1.0820,
"tp": 1.0910
}
What a TradingView alert is
An alert combines a condition, a trigger frequency, an expiry date and one or more notifications. It runs on TradingView's servers, not in your browser: once created, it fires even with your computer switched off. How many active alerts you can keep depends on your TradingView plan.
- Condition: a price, an indicator, a Pine Script strategy or a drawing
- Trigger: once, every time, once per bar close or once per minute
- Notifications: app, pop-up, email, sound or webhook
Creating an alert, setting by setting
Open the alert window with the Alert button (the clock in the top toolbar), the Alt + A shortcut, or a right-click on the chart. Pick the condition first: the symbol crosses a price, an indicator crosses a level, or a strategy fills an order. Then set the frequency and the expiry, name the alert, write its message, and tick the notifications you want in the Notifications tab.
- Expiry: a set date, or open-ended (not available for watchlist alerts)
- Name: it is what shows in the log and in notifications
- Message: free text, where TradingView fills in the variables when it fires
Which frequency to pick for an automated order
A price alert offers two choices only: once, or every time. An indicator or strategy alert offers more, including “once per bar close”. For placing orders it is the safest setting: the signal is confirmed when the bar closes, whereas mid-bar a crossover can appear and then vanish. TradingView only fires an on-close alert if the condition still holds at that moment.
- Once per bar close: a confirmed signal, the setting to prefer for trading
- Every time: faster, but a signal can vanish before the close
- Once: the alert switches itself off after it first fires
The alert message and its variables
The Message field is free text. The moment the alert fires, TradingView replaces every variable written between double curly braces with its value: the symbol, the bar's closing price, the time. That is what lets a single message stay correct on any chart.
{{ticker}}The chart's symbolEURUSD{{exchange}}The exchange the symbol is quoted onOANDA{{close}}The closing price of the bar that fires1.08425{{open}} {{high}} {{low}}That bar's open, high and low1.08390{{volume}}The bar's volume1532{{interval}}The chart timeframe15{{time}}The bar time, in UTC2026-09-23T14:15:00Z{{timenow}}The firing time, in UTC2026-09-23T14:29:07Z{{plot_0}}The indicator's first plot71.4{{syminfo.currency}}The quote currencyUSD- Values are those of the bar that fired the alert
- {{time}} and {{timenow}} are always in UTC
- Up to 20 indicator plots: {{plot_0}} to {{plot_19}}
Pine Script strategy variables
An alert set on a strategy fires on each of the strategy's orders and gets extra variables. Mind the trap: {{strategy.order.action}} is “sell” both to open a short and to close a long, so sent as is, closing a long would open a short. The safe method: write the exact command in the alert_message parameter of each strategy order, and put {{strategy.order.alert_message}} as the alert's message.
{{strategy.order.action}}“buy” or “sell”, for entries and exits alikesell{{strategy.order.contracts}}The quantity of the order, in the strategy's units10000{{strategy.order.price}}The order's fill price1.08425{{strategy.market_position}}The strategy's position: long, flat or shortflat{{strategy.order.alert_message}}The text passed to alert_message{"action":"closelong",…}//@version=6
strategy("Moving average crossover", overlay = true)
fast = ta.sma(close, 20)
slow = ta.sma(close, 50)
if ta.crossover(fast, slow)
strategy.entry("L", strategy.long, alert_message = '{"action":"buy","symbol":"' + syminfo.ticker + '","risk":1}')
if ta.crossunder(fast, slow)
strategy.close("L", alert_message = '{"action":"closelong","symbol":"' + syminfo.ticker + '"}')
- Alert message: {{strategy.order.alert_message}}, nothing else
- One command per order: buy to enter, closelong to exit
- {{strategy.order.contracts}} is a strategy quantity, not a MetaTrader lot
Receiving the alert: notifications and webhook
In the Notifications tab, each box is a channel: in-app notification, on-screen pop-up, email, sound, or webhook. The webhook is the only channel built for a machine: TradingView sends the message in an HTTP POST request to the address you enter. A valid JSON message goes out with an application/json header, any other text as text/plain. It is the channel execution bridges use.
- Webhook: a paid TradingView plan, Essential or higher
- Two-factor authentication enabled on your TradingView account
- An https address (ports 80 and 443 only), answered within 3 seconds
Sending the alert to MT4, MT5 or cTrader
TradingView executes nothing at your broker: you need a bridge that receives the webhook and passes the order to the terminal. With TheConnector, paste your account's webhook address into the Webhook URL field, put the JSON message in the Message field, and keep the robot running in MT4, MT5 or cTrader. The same message works on all three platforms, and each alert stays tracked from receipt to the broker's answer.
https://webhook.theconnector.fr/YOUR_ACCESS_KEY
{"action":"buy","symbol":"{{ticker}}","risk":1,"sl":20,"tp":40}
- One address per account: keep it secret, like a password
- The same message for MT4, MT5 and cTrader
- Every alert tracked: Received, Routing, ACK, Delivered
Why an alert does not fire
Most “silent” alerts have a simple cause. The alert expired, or it was set to “once” and switched itself off after firing. TradingView also stops an alert that fires more than 15 times in 3 minutes. On a closed market no new quote arrives, so nothing fires. Finally, an alert may have fired without notifying you: the alert log shows it, with a delivery status column for webhooks.
- Expired, or already fired “once”: reactivate it
- More than 15 triggers in 3 minutes: TradingView stops it, make the condition more selective
- Repainting indicator: the real-time signal differs from the history
- Webhook with no effect: check the delivery status in the alert log
Testing before going live
Before letting an alert place orders, check each link separately. First paste the message into the webhook tester: it shows what the bridge understands, without executing anything. Then fire an alert toward a demo account and follow it in the history. Only after a few uneventful sessions does the alert deserve a live account, at minimal volume.
- The message, in the webhook tester
- A real alert, toward a demo account
- The live account, at minimal volume
Related guides
FAQ
How many alerts can you create on TradingView?
It depends on your TradingView plan: a few active alerts on the free plan, many more on paid plans. The exact number is on TradingView's pricing page, which changes it over time.
Does a TradingView alert work with the computer switched off?
Yes. Alerts run on TradingView's servers: they fire and send their webhooks even with your browser closed. Only the Relay browser extension, built for testing without a paid plan, needs the tab open.
Do you need a paid TradingView plan for webhooks?
Yes: the Webhook URL field requires a paid plan, Essential or higher, and two-factor authentication turned on. Without a paid plan, you can get the alert by email, or test TheConnector with the Relay extension.
Which frequency should you pick for automated trading?
“Once per bar close”, on an indicator or strategy alert: the signal is then confirmed. Mid-bar, a crossover can appear and disappear after the order has already gone out.
Do the variables work inside a Pine script?
Variables in double curly braces are replaced in the alert message. In Pine code, you instead build the text from the script's own values, such as syminfo.ticker or close, then pass it to alert() or to a strategy's alert_message parameter.
Why did my alert stop on its own?
Three causes come up: it reached its expiry date, it was set to “once”, or it fired more than 15 times in 3 minutes and TradingView stopped it. The alert manager shows its status.