WhitmanTrading

How to Set TradingView Alerts: Conditions, Scripts and Webhooks

To set TradingView alerts, choose what the alert watches, the operator, the frequency and an expiration, then write a message and pick where it is delivered. The alert then runs on TradingView's servers as a saved copy of the chart's symbol, timeframe and settings, so later edits to the chart do not change it.

TradingView alerts are conditions that TradingView checks on its own servers and reports to you when they come true: a price crossing a level, an indicator leaving a range, a Pine script calling alert(), or a strategy filling an order. Nothing needs to stay open on your computer, and the same dialog handles all of them.

This page is the mechanics of TradingView’s alert system. The habit of choosing a level before setting anything is on how to set a price alert, and what the platform is as a whole is on the TradingView page.

Before you start

A chart open on the symbol and timeframe the alert should watch, because the alert copies both. The Help Center, read 26 Sep 2026, says a plain price alert ignores the chart’s interval, while alerts on indicators, drawings and strategies use it in their calculation. A moving-average cross on the hourly chart and on the daily chart are two different alerts.

One condition you can name in a sentence. “Close above the line I drew at the March high” can be built. “Tell me when it looks strong” cannot, because the dialog needs a source, an operator and a value.

Somewhere to receive it that you check. The app, a browser pop-up, email, a sound, plain text to an alternative address, or a webhook URL. For a webhook you also need a receiving server you control and two-factor authentication switched on, which TradingView requires before it allows webhook alerts.

The steps

1. Open the chart on the timeframe the alert should use

Load the symbol and set the interval first. Then open the dialog with the Create alert button on the top toolbar, from the right-click menu, or with Alt + A on Windows (Option + A on a Mac).

2. Pick the condition source: price, a drawing, an indicator or a strategy

The first dropdown decides the kind of alert. Price watches the symbol itself. A trend line, channel, rectangle or Anchored VWAP can carry its own alert. Any indicator on the chart, including community scripts, appears in the list, and so does a strategy added from the Strategies section of the Technicals tab. The free vs paid comparison shows which of these kinds your plan allows.

3. Choose the operator that matches the event

Crossing fires from either direction; Crossing up and Crossing down fire from one. Greater than and Less than on price need the move to exceed the level by at least one minimum tick. Entering, Exiting, Inside and Outside Channel work on two boundaries. Moving up, Moving down and their % versions measure a change over a set number of bars.

4. Set the frequency to match how the signal is confirmed

Pick one of the four frequencies described in the next section. For anything built on an indicator or a script, Once per bar close is the choice that matches what the chart shows after the bar finishes.

5. Set the expiration and the notification schedule

Alerts stop on their own when they expire, and how long one can run depends on the plan. The notification schedule is separate: it mutes delivery outside chosen hours, while the alert keeps triggering and keeps writing to the log.

6. Write a message with message variables

TradingView fills in message variables when the alert fires. Each one is typed as the variable’s name wrapped in two pairs of curly brackets, so a message built from the ticker, close and interval variables arrives with the symbol, the closing price and the chart’s interval written in.

The dialog accepts 4,000 characters; a Pine alert() message can run to 40,960. Put the reason for the alert in the text, because the message is all that arrives when it fires.

7. Choose delivery, and add a webhook only for a receiver you control

Tick the channels you will actually read. A webhook sends the message as an HTTP POST to your URL, which is how alerts reach a spreadsheet, a chat bot or a trading tool, and it needs its own care (below).

8. Fire a test and read the alert log

Set a throwaway alert a tick away from the current price with Once only, wait for it to trigger, and open the log. It lists the trigger, its Webhook status column shows whether a webhook got through, and the manager shows whether the alert is still running.

How to tell it worked

The test alert shows 1 trigger in the log with every variable replaced by a value. A message that still shows the close variable’s name in its brackets on an alertcondition() alert most likely means the script was written in a Pine version older than v4.

The alert manager lists the alert as Active, not Stopped, with the symbol and interval you meant.

A script alert set to Once per bar close fires at most 1 time per bar, at the bar’s close time.

A webhook trigger shows no error in the log’s Webhook status column, and your receiver recorded exactly 1 request for it, answered within 3 seconds.

The four frequencies, and the one to use

Once only fires the first time the condition is met and then stops, so the manager shows it as Stopped, Triggered. It suits a level you want to hear about once.

Once per bar checks each bar and fires at most one time per bar, as soon as the condition is true during it. On an indicator this can fire on a bar that later closes back on the other side.

Once per bar close waits until the bar has finished. Pine’s own FAQ recommends it for exactly this reason: values on an unconfirmed bar move with every tick.

Once per minute, which the Help Center lists together with every time, checks conditions each minute and fires whenever they hold. A simple price alert is always worked out on 1-minute bars anyway, which is why the interval variable returns 1 on one.

Alerts from Pine Script: alert() and alertcondition()

Code cannot create a running alert. The Pine Script v6 manual says a script only creates alert events; someone still has to open the dialog and choose the script as the condition. Alerts also fire only on real-time bars, never on history.

alertcondition() adds a named choice to the Condition list. Its message must be a fixed string and it works in indicators only. The manual says it stays for backward compatibility and for offering separate named choices in the dialog.

alert() is the newer and more flexible call. It works in indicators and strategies, its message can be built while the script runs (a price, a level, a JSON object), and the code sets its frequency: alert.freq_once_per_bar, alert.freq_once_per_bar_close or alert.freq_all. For those alerts the dialog’s frequency and message fields no longer apply, and you choose Any alert() function call instead.

A strategy alert can fire on order fills, on alert() calls, or both. Fills on historical bars send nothing. Message variables such as strategy.order.action and strategy.order.price report what the broker emulator did, which is the simulated fill a strategy tester run shows, not a trade at any broker. The Pine Script page covers the language itself.

Webhooks: what TradingView sends, and its limits

The message is the body of the request. Valid JSON goes out with an application/json header; anything else goes out as text/plain.

A JSON object with a “ticker” key holding the ticker variable in double quotes and a “close” key holding the close variable bare arrives as JSON your server can parse. Single quotes in place of double quotes make it invalid JSON, so it goes out as plain text.

The receiving end has to be quick and on a standard port. Only ports 80 and 443 are accepted, IPv6 is not supported, and a request that takes longer than 3 seconds is canceled. If your server answers with a 500-range error other than 504, TradingView resends after 5 seconds, up to 3 more times.

That means one trigger can arrive as many as 4 times. Our advice here, not a TradingView setting: start every message with a short label for the alert, add the ticker and timenow variables, and have a receiver that places orders ignore a second request carrying the same three values.

Never put a password or login in the URL or the message. TradingView’s own article on webhook credentials says so, and adds that its alerts are not designed for automated trading. A trading bot built on webhooks inherits every delay and gap listed here; the automate a strategy page covers what else it needs.

The original data

In the 24,971 unique videos of this site’s search study, 57 have a title naming TradingView and alerts, counted with the site’s standard whole-word method. They come from 48 channels, have a median of 2,199 views, and 23 of the 57 are under 1,000. Two passed 100,000, at 204,395 and 119,922 views.

Each title was placed in one group by the first rule it matched, in this order: automation or bots, a named indicator, Pine Script or strategy, many symbols at once, price or drawings, delivery, and general. Indicator alerts are the largest group, 15 titles at a median of 2,046. Delivery titles about phones, apps, email and text number 10, at 942.

Bar chart of median views for 57 TradingView alert video titles split into seven groups, with Pine Script or strategy titles and automation titles far above the rest.
Median views of TradingView alert video titles by what the title covers, with the number of videos in each group. Source: search-study corpus, title groups (tradingview-alert-video-groups-2026-09-26-m39.csv)

The titles that go past clicking the button drew far more views. The 3 automation titles have a median of 56,410 and the 6 Pine Script or strategy titles 31,119. Together those 9 sit at 36,296, against 1,747 for the other 48. Groups of 3 to 15 videos are small, and one popular upload moves a median a long way, so read this as a sign of interest rather than a ranking.

Not one title uses the word webhook, and the whole study holds only 2 webhook titles. The corpus carries description text for 47 of the 57 alert videos. None of those 47 mentions webhooks, expiration, bar close, repainting, or the alert() and alertcondition() functions.

The videos are also short. Their median length is 2.9 minutes, against 6.7 for all 1,044 titles naming TradingView and 12.1 for the whole study. The Pine Script or strategy titles are the exception, at a median of 16.0 minutes.

Bar chart comparing median video length for TradingView alert titles, Pine Script or strategy alert titles, all TradingView titles and the whole study.
Median length in minutes of TradingView alert videos against wider groups in the same study. Source: search-study corpus, title groups (tradingview-alert-video-groups-2026-09-26-m39.csv)

One limit on these counts: 42 of the 57 came from a single search, “how to set alerts on tradingview”, so the sample leans toward tutorials. The corpus has no upload dates, so no trend over time can be drawn. Every group, its rule and its figures are in the title groups CSV, and each of the 57 titles with its group is in the alert titles CSV.

When it fails

The first failure is an alert on an unfinished bar. Once per bar, or alert.freq_all, reports a cross that the closed bar then undoes. On reload the chart shows no signal, and the log shows one.

The second is editing the chart and expecting the alert to follow. It kept a copy of the script, its inputs and the timeframe. Change the length of a moving average and the old alert still fires on the old length until you delete it and create a new one.

A third is a noisy script. More than 15 triggers in 3 minutes and TradingView stops the alert. A script that hits a runtime error also stops producing alerts, because the error halts the script.

A fourth is a silent expiry. An alert past its date shows Stopped, Expired in the manager and sends nothing. The log also clears itself: entries older than 30 days go, and only the latest 100 triggers per alert are kept. A Once per bar alert on a 5-minute chart that fires on every bar of a 6.5-hour US session logs 78 triggers a day, so the log holds under two sessions of it. Export the log to CSV before then.

A fifth is delayed data. If the exchange variable in a message comes back ending in _DL or _DLY, the symbol is on delayed data, and the alert is firing on a delayed price.

And a sixth is treating a webhook as an order route. A slow receiver, a nonstandard port or a repeated request breaks the chain without any error on the chart.

TradingView explains the platform as a whole and the difference its plans make, and the free vs paid comparison lists how many alerts each plan allows. Pine Script explains the language behind script alerts, and how to write a Pine script is the place to start one. For the habit of deciding a level before any alert is set, how to set a price alert is the companion to this page.

What I actually do

Set anything built on an indicator to Once per bar close. A condition can be true halfway through a bar and false when it finishes, and an alert that fires on the unfinished bar reports a signal the chart will never show.

— Michael Whitman

This page is educational, not financial advice. Test every idea on your own charts before risking money.