TradingViewAlertsPineScriptAutomation

TradingView Alerts: The Complete Setup Guide for Automated Trading

Alerts are the engine behind every automated TradingView strategy. Here's exactly how to configure them so signals arrive fast, reliably, and in the right format.

TradeSgnl Team

Author

7 min read

TradingView alerts are the starting point for everything in automated trading. Get them right and your strategy fires reliably, every time. Get them wrong and you'll deal with missed signals, wrong instruments, or trades executing at the worst possible moment.

This guide covers the full picture—from basic alert setup to webhook configuration to PineScript conditions—so you can stop guessing and start trading systematically.

How TradingView Alerts Actually Work

When a condition is met on your chart, TradingView sends a notification. With a Pro account or higher, one of those notification options is a webhook—an HTTP request to a URL you specify, containing a message you define.

This is the mechanism that makes automation possible. TradingView doesn't "talk" to MetaTrader 5 directly. Instead, it sends a webhook to an intermediary service (like TradeSgnl), which translates the message and delivers the signal to your MT5 platform in real time.

Understanding this flow matters because it tells you where problems can originate: the alert condition itself, the webhook URL, the message format, or the receiving service.

Choosing the Right Alert Condition

TradingView gives you four ways to trigger alerts:

Price crossing a level — Simple and reliable. Useful for key support/resistance levels. No indicator required.

Indicator conditions — Trigger when an indicator crosses a value or another indicator. RSI crossing 30, MACD line crossing signal, moving average crossovers. These are the most common for systematic strategies.

PineScript alertcondition() — Define exactly when the alert fires, directly in your script. This is the most precise and flexible option.

Drawing-based alerts — Trigger when price interacts with trendlines, channels, or Fibonacci levels you've drawn. Useful for discretionary traders adding automation.

For systematic strategies, PineScript alertcondition() is almost always the right choice. It gives you complete control and fires at the exact close or bar where your logic says it should.

Don't want to write PineScript? The TradeSgnl Strategy Builder is a no-code TradingView indicator (included with Advanced and Professional plans) that lets you build entry and exit conditions visually—using any indicator on your chart—and generates the correct alert messages automatically. If you'd rather configure logic through dropdowns than write code, start there instead.

Writing PineScript Alert Conditions

If you're building a strategy in PineScript, defining your alert conditions in code is straightforward:

//@version=5
strategy("My Strategy", overlay=true)

fastMA = ta.ema(close, 9)
slowMA = ta.ema(close, 21)

longCondition = ta.crossover(fastMA, slowMA)
shortCondition = ta.crossunder(fastMA, slowMA)

alertcondition(longCondition, title="Long Entry", message="YOURLICENSE,EURUSD,buy,0.01,50,100,EMA_Cross")
alertcondition(shortCondition, title="Short Entry", message="YOURLICENSE,EURUSD,sell,0.01,50,100,EMA_Cross")

When you add an alert in TradingView, you'll see your named conditions in the dropdown. Select the condition, configure the webhook, and you're done.

One important detail: alertcondition() fires based on bar close by default when you select "Once Per Bar Close" in the alert settings. This is the recommended setting for most strategies—it prevents multiple firings on the same bar and ensures you're acting on confirmed signals.

Configuring the Webhook

The webhook is where most people make mistakes. Here's what to get right:

URL — This is provided by your signal delivery service. For TradeSgnl, you'll find your unique webhook URL in the dashboard. Copy it exactly; even a single character error means no signals.

Message format — TradeSgnl uses a comma-separated text format. The message you type into the TradingView alert field becomes the signal sent to your EA:

YOURLICENSE,EURUSD,buy,0.01,50,100,MyStrategy

The fields are: LicenseID, symbol, action, volume, stop-loss (pips), take-profit (pips), comment. For a close signal you'd use:

YOURLICENSE,EURUSD,closebuy,0,0,0,MyStrategy

The comment field is important — trades with the same comment are managed as a group, so keep it consistent across your entry and exit alerts for the same strategy.

One alert per condition — Don't try to pack multiple signals into one alert. Keep it simple: one alert condition, one clear action.

Alert Expiration: The Silent Killer

This is the most common cause of "why did my strategy stop working?"

TradingView alerts expire. By default, they expire after 2 months. When an alert expires, it stops firing silently—no notification, no warning. Your strategy just stops executing.

The fix is simple: when creating an alert, set the Expiration field to "Open-ended alert." This keeps the alert active indefinitely. You can also set a specific far-future date if you prefer.

Get into the habit of checking your active alerts periodically. TradingView shows you all active alerts in the Alerts panel on the right sidebar.

Symbol Naming: A Common Source of Confusion

TradingView and MetaTrader 5 don't always use the same symbol names. TradingView might show EURUSD while your broker's MT5 shows EURUSDm or EUR/USD.

There are two ways to handle this:

Static mapping — Hardcode the broker symbol name in your alert message. If you know your broker uses EURUSDm, write that in your alert message.

Service-side mapping — TradeSgnl lets you configure symbol translations in the dashboard. You write EURUSD in all your alerts, and the service maps it to whatever your broker uses. This is much cleaner when you have multiple instruments or brokers.

Testing Before Going Live

Never go live without testing on a demo account first. The testing workflow is:

  1. Set up the alert with your webhook URL
  2. Wait for a condition to trigger (or use the TradingView strategy tester to simulate one)
  3. Check your service's dashboard to confirm the webhook was received
  4. Check your MT5 demo account to confirm the trade was placed
  5. Verify the symbol, direction, and lot size are all correct

If something is wrong, you want to discover it with demo money, not real money.

What to Do When Alerts Miss

Occasionally you'll notice a signal fired on the chart but no trade appeared in MT5. Before assuming the worst, work through the checklist:

  • Is the alert still active? Check the Alerts panel for the green active indicator
  • Did the webhook fire? Check your service's log for an incoming webhook at the expected time
  • Was MT5 connected? Check the EA log in MetaTrader for connection status at the time
  • Was the market closed? Some brokers reject orders outside trading hours

Most issues are either alert expiration, a disconnected EA, or a symbol name mismatch. All are fixable in minutes once you know where to look.

Building a Robust Alert Setup

A few final principles that separate reliable setups from fragile ones:

Use "Once Per Bar Close" for condition-based alerts. It's cleaner and prevents alert spam during volatile bars.

Keep alert messages simple. The more complex the message, the more ways it can break. Start with the minimum your service needs.

Separate long and short into different alerts. Don't try to combine buy and sell signals in a single alert with conditional logic. Two clean alerts are better than one complicated one.

Run MT5 on a VPS, not your home computer. If your computer restarts or loses internet, your EA disconnects and signals are missed. A VPS runs 24/7 with no interruptions.

Ready to put your TradingView alerts to work? See how TradeSgnl connects them to MetaTrader 5 →

Ready to automate your trading?

Join traders who have transformed their strategies with TradeSgnl. Connect TradingView to MetaTrader 5 in minutes.

TradeSgnl

Professional TradingView to MetaTrader 5 automation platform.

© 2026 TradeSgnl. All rights reserved.

Powered by advanced trading algorithms

TradeSgnl provides an order routing tool connecting trading strategies to MetaTrader accounts. We do not offer alerts, signals, or trading advice. All information is for informational purposes only. We do not guarantee the platform's availability, accuracy, or timeliness, and users are responsible for any losses resulting from errors, delays, or unavailability. Use of MetaTrader, brokers, or other third-party services is at your own risk. Trading involves significant risk, including losses greater than your initial investment. Only trade with capital you can afford to lose, and seek independent financial advice to understand the risks.