# TradingView alerts: trade your own indicators and strategies

A TradingView listener gives you one address. Paste it into your TradingView alerts and every alert they send is traded on your MetaTrader 5 account, by your settings and limits, like a Telegram signal. This article covers what you need, setting up a listener and an alert, the test alert, the alert log, the Buy, Sell and Close addresses, a new address, and the questions people ask first.

## What you need

- **A Relay2Trade plan or the demo days**, and the app running on your computer or a VPS with MetaTrader 5 connected (see https://relay2trade.com/help/getting-started.md). The app places the trades; while it is off, alerts wait for it up to your "Max signal age (min)" and are then left out.
- **A TradingView account that can send webhooks.** TradingView sends alerts to an address only on its paid plans (Essential and up), and only once two-factor authentication (2FA) is on in your TradingView account (its account settings, under "Privacy and Security"; an account that signs in with Google or another service sets a TradingView password first).
- **Nothing in your script changes.** The alerts you already have work as they are: we read TradingView's own strategy messages, PineConnector lines, JSON from other tools and plain text.

A TradingView listener counts toward your plan's number of listeners, like a Telegram one. Alerts we read exactly do not count toward your daily signals; only an alert in plain words, which our reader has to read, counts (see https://relay2trade.com/help/tradingview-settings-and-limits.md).

## Add a TradingView listener

In the Desk, under Connections:

1. Press "+ Add" beside "Listeners" and choose "TradingView alerts".
2. Give it a "Name" you will recognise, for example the strategy's name.
3. Under "What does it trade? (optional)", type your broker's name for the symbol it trades, for example XAUUSD. It is used only when an alert does not name its symbol.
4. Press "Add listener". It is made at once, and its setup opens.

A new TradingView listener starts on "Watch": its alerts are read and shown, and nothing is traded. You let it trade once a test alert has gone through (see "Let it trade" below).

![Choosing TradingView alerts in "Add a listener"](/img/help/tradingview/add-listener.png)

Your Telegram does not have to be connected for a TradingView listener, and the app does not have to be running to make one.

## Copy your address

The setup ("Set up in TradingView", in the listener) shows "Your address for TradingView", with a copy button. It is the listener's alone. Anyone who has it can send alerts to this listener, so keep it to yourself as you would a password.

![The listener's address and setup steps](/img/help/tradingview/setup.png)

## Set up the alert in TradingView

What to do depends on what sends the alert: a strategy, an indicator, or a line or price you drew. The setup in the Desk asks the same question ("What sends the alert?") and shows only that part, with these pictures. For an indicator it also asks "How does the alert say buy or sell?" and "How does a trade end?", and shows the addresses your answers need.

### A strategy

1. On your chart, open "Alert" and choose "Create manually". Under "Condition", choose your strategy.
2. Leave the "Message" as it is. TradingView's own message for a strategy says what each order did ("…: order buy @ 1 filled on XAUUSD. New strategy position is 1"), and we read it exactly. Some strategies come with their author's own message instead: look at "Last alerts" after the first one.
3. Open "Notifications", tick "Webhook URL" and paste your address. Keep "Notification schedule" on 24/7, then press "Apply".
4. Press "Create".

![TradingView's alert window on a strategy: Condition, Interval, Message, Notifications](/img/help/tradingview/tv-alert-strategy.png)

![TradingView's Notifications: Webhook URL ticked with the address, Notification schedule on 24/7](/img/help/tradingview/tv-notifications.png)

The setup also asks "Does your strategy add to a position that is already open?". Answer "Yes, it adds" if your strategy buys again while it is already in a buy (pyramiding): each entry then opens another trade, and the strategy's exit closes them all. With "No", a second entry while one is open is left out as repeated.

Relay2Trade's stop-loss can close a trade before your strategy exits. From then until the strategy's next exit, your account and the strategy can differ. Likewise, a partial close smaller than your broker's minimum lot cannot be made.

One alert follows every order the strategy makes from then on: entries, exits and reversals. Orders on past bars send nothing, so the first alert comes with the strategy's next live order. If TradingView shows a second list under "Condition" for your strategy ("Order fills only", "alert() function calls only"), choose one of the two "only" ones, or an order can arrive twice.

### An indicator

1. On your chart, open "Alert" and choose "Create manually". Under "Condition", choose your indicator, then, in the list under it, its buy signal (for TradingView's Supertrend: "Downtrend to Uptrend").
2. Under "Trigger", choose "Once per bar close". TradingView often starts a script's alert on "Once only", which stops after the first signal, and an alert on a bar still forming can fire on a move the closed bar takes back.
3. Open "Notifications", tick "Webhook URL" and paste the **Buy address** (your address with /buy at the end). Keep "Notification schedule" on 24/7, press "Apply", then "Create".
4. Make a second alert the same way on its sell signal, with the **Sell address** (/sell at the end).

![TradingView's alert window on an indicator's buy signal, with "Once per bar close"](/img/help/tradingview/tv-alert-indicator.png)

![TradingView's Trigger list: Once only, Once per bar, Once per bar close, Once per minute](/img/help/tradingview/tv-trigger.png)

![TradingView's Notifications with the Buy address](/img/help/tradingview/tv-notifications-buy.png)

If the indicator's message already says buy or sell ("BUY signal"), your plain address works too. An indicator whose condition is "Any alert() function call" needs one alert only: the script writes its messages and decides when they fire, so paste your plain address and there is no "Trigger" to choose.

### A line or a price

1. Right-click your line, or the chart at the price you want, and choose "Add alert…".
2. Under "Trigger", choose "Once only" to trade the first crossing, or "Once per bar close" to trade each one.
3. Open "Notifications", tick "Webhook URL" and paste the Buy address to buy, or the Sell address to sell. The Close address closes this listener's trades on the symbol instead. Keep "Notification schedule" on 24/7, press "Apply", then "Create".

From then on each time the alert fires, TradingView sends it to your listener, and the app trades it within a second or two of its arrival.

Four things TradingView does that are worth knowing before the first alert:

- **An alert keeps the script as it was.** TradingView runs each alert on its servers with a copy of the script, its inputs, the symbol and the timeframe from when you made it. Change any of them later and the alert goes on with the old ones: delete the alert and make it again.
- **Alerts expire.** A standard alert lasts two months at most. Premium and Ultimate plans can choose an open-ended alert. When an alert expires nothing more comes to your listener, so note when yours end.
- **The notification schedule.** "Notification schedule", at the end of the alert's "Notifications", sets the hours when the alert notifies. Outside them TradingView sends no webhook at all, and the schedule you chose last is offered again on your next alert. For trading, keep it on 24/7.
- **An alert that fires too often is stopped.** TradingView stops an alert that fires more than 15 times in 3 minutes. An alert on "Once only" stops after its first time by design. Both show as stopped in TradingView's alerts list, where you can start them again.

## Send a test alert

Under "Send a test alert", press "Buy", "Sell" or "Close". The test goes all the way to your app, which answers what it would do with your settings now. Nothing is placed.

A test tells you the address, the app and the listener's settings work. It does not test TradingView: to see a real alert arrive, keep the listener on "Watch" and let your alert fire once.

## Let it trade

Under "Let it trade", in the setup, choose how the listener trades: "Watch" (read and shown, nothing traded), "Manual" (each alert waits for your approval) or "Auto" (traded at once).

- **Auto opens once a test alert has gone through**, one the app answered it would place. Until then, send one under "Send a test alert".
- **Auto asks you first**, as for any listener: every alert becomes a real order on your account.
- **With no stop-loss anywhere**, when your alerts send none and neither the listener nor the profile sets one, Auto asks once more, and goes on only when you press "Trade on Auto without a stop-loss". Or set a stop-loss first.

The same rules hold when you switch the mode from the app's window or from an AI assistant you allowed.

## The alert log

"Last alerts" lists every alert the listener received, newest first, with:

- when it came and what it is: "Done", "Not placed", "Not understood", "Too old", "No app signed in", "Listener off" and the others;
- how it was read: "TradingView strategy", "PineConnector format", "JSON message", "Relay2Trade format", "Text, read by the reader", or "From the address";
- what the app did: "1 placed", "1 waiting for your approval", "applied to 2 trades", and its reasons when it did not place it;
- the message exactly as TradingView sent it.

![The alert log with a placed alert and one not understood](/img/help/tradingview/alert-log.png)

A trade the app placed also has its own story under Signals, like any signal (see https://relay2trade.com/help/the-signal-story.md).

## Alerts that don't say buy or sell

Some alerts only say something like "Price crossed the line" or "Crossing Up". For those, the address has three endings, under "Alerts that don't say buy or sell":

- the **Buy address** (your address with /buy at the end) buys;
- the **Sell address** (/sell) sells;
- the **Close address** (/close) closes this listener's trades on the symbol.

Use the Buy address on the alert that should buy, and the Sell address on the one that should sell. The symbol comes from the alert when it names one, otherwise from "What does it trade?". On an alert that does say a side, the ending decides.

Nothing is guessed. An alert sent to your plain address that does not clearly say buy, sell or close ("Signal", "Supertrend buy and sell zone", "BUY stopped out") is not traded, and the log says "Unknown direction". An alert that names no symbol trades on "What does it trade?": once you choose a symbol there, every alert that says only buy or only sell trades on it, an indicator's own message too ("Q-Trend BUY signal were given."). With nothing chosen there, only a short command is an order (the word alone or with at most two more: "sell", "buy now please"), and longer text is not traded: the log says the alert does not say which symbol to trade.

## Write the message yourself

To decide more from TradingView, open "Write the alert's message yourself" in the setup. Choose "For a strategy" or "For an indicator or a drawing", then what the alert does: the stop-loss and take-profits (as prices or pips), the size, a breakeven, a trailing stop, a spread limit. Press "Copy the message" and paste it into the alert's "Message" box in TradingView, replacing what is there. "Send it as a test" sends that very message as a test alert.

![The message builder](/img/help/tradingview/builder.png)

Every message we read, with examples, is in https://relay2trade.com/help/tradingview-alert-messages.md.

## A new address

"New address" makes a new address for the listener. The old one stops working at once, so every TradingView alert that used it needs the new one pasted in. Use it if your address was seen by someone else.

## Common questions

**Do I have to change my indicator or strategy?** No. A strategy's alert keeps its message as it is. An indicator's alerts use the Buy and Sell addresses, or your plain address when their message already says buy or sell.

**Does TradingView need to stay open?** No. Alerts run on TradingView's servers. Your app has to run, with MetaTrader 5 connected.

**What if my app was off when the alert came?** You are told at once, in your inbox and on your phone. An entry waits for the app up to the profile's "Max signal age (min)" (5 minutes unless you changed it); older than that, it is not placed, and the log says "Too old". An exit (a close or a partial close) waits for the app however long it takes: your position stays open until the app is back, then it closes.

**Which app do I need?** Relay2Trade 3.0 or later, on your computer or a VPS. It updates by itself; an older app is not given TradingView listeners, and an alert sent to it says to update.

**How many alerts can a listener take?** Up to 120 in 10 seconds and 720 a minute, each listener. Alerts that arrive together are read one after the other, in the order they came.

**Is a listener for one chart or one symbol?** No. One listener, one address, takes alerts from as many charts, symbols, indicators and strategies as you like, and each alert is traded on the symbol it names. "What does it trade?" is only for alerts that name none. Use the listener's "Symbols" to allow only some.

**My indicator's alert names no symbol and I use it on several charts.** TradingView does not tell us which chart an alert came from, so such an alert is traded on "What does it trade?". Put the symbol into its message (`{{ticker}}` does it for you, see https://relay2trade.com/help/tradingview-alert-messages.md), or give each chart's alert a listener of its own with its own "What does it trade?".

**My alert fired in TradingView, but nothing came under "Last alerts".** Check that the whole address, starting with https://, is in the alert's "Webhook URL", that two-factor authentication (2FA) is on in your TradingView account, and that the alert's notification schedule covers the hour it fired. An alert made from a saved preset needs the address pasted again. TradingView's own alert log (the "Log" beside your alerts) shows for each alert whether the webhook was delivered. A test alert from the setup tells you whether the listener and the app work.

**My alerts stopped coming after a while.** Look at the alert in TradingView's alerts list. Most often it expired (two months at most, unless your plan offers open-ended alerts), it fired more than 15 times in 3 minutes and TradingView stopped it, or it was set to "Only Once". If it was made before you changed the script or the chart, delete it and make a new one.

**Can I have several TradingView listeners?** Yes, one for each strategy or way of trading, each with its own mode, settings and address, as many as your plan's listeners allow.

**Can I see my TradingView alerts and my Telegram signals together?** Yes. Signals lists both; each one says the listener it came from.
