May 7, 2026

How to Use TradingView Alerts With a Trading Bot: A Complete Setup Guide

TradingView is the most widely used charting platform in the world, and for good reason. Its Pine Script language lets you build virtually any technical indicator or strategy logic you can imagine. But TradingView on its own does not execute trades — it only generates alerts. To turn those alerts into automated orders, you need to connect TradingView to a trading bot using webhooks. This guide walks you through exactly how that connection works, how to set it up step by step, and how to avoid the most common mistakes that prevent alerts from firing correctly in live trading.

What Is a TradingView Webhook Alert?

A webhook is a way for one application to send real-time data to another application when a specific event occurs. In TradingView's case, when your alert condition is triggered — a moving average crossover, an RSI threshold breach, a price level hit — TradingView can send an HTTP POST request containing a JSON message to a URL you specify. That URL belongs to your trading bot platform, which receives the message, interprets it, and places an order on your exchange or broker accordingly. The entire process from alert trigger to order placement typically takes one to three seconds, making it fast enough for most retail trading strategies.

What You Need Before Getting Started

To set up TradingView alerts with a trading bot, you need a TradingView account with at least a Pro subscription — webhook functionality is not available on the free plan. You also need a trading bot platform that supports incoming webhook alerts, such as 3Commas, Alertatron, WunderTrading, or a custom server. Your exchange API keys need to be connected to the bot platform, and the bot platform needs to provide you with a webhook URL that TradingView will send alerts to. For more on API key setup and security, see our guide on What Is a Trading Bot API? How to Connect and Automate Like a Pro.

Step 1: Build Your Strategy or Indicator in Pine Script

The first step is creating the signal logic in TradingView. This can be a built-in indicator like RSI or MACD, a community-published script, or a custom strategy you write in Pine Script. Whatever generates your signal — a crossover, a threshold, a pattern — becomes the basis for your alert condition. If you are using a Pine Script strategy (using the strategy() function), you can set alerts directly on strategy entry and exit signals. If you are using an indicator (using the indicator() function), you create alert conditions using the alertcondition() function, which gives you more flexible control over exactly when and how often alerts fire.

Step 2: Configure the Alert in TradingView

Once your signal logic is ready, open the Alerts panel in TradingView and create a new alert. Select your script or indicator as the condition source. Choose the specific condition you want to trigger the alert — for example, "strategy entry" or a custom alertcondition you defined. Set the alert frequency carefully: "Once per bar close" is the most reliable setting for most strategies because it only fires after a candle fully closes, preventing false signals from intra-bar price noise. Set the expiry date far enough in the future that the alert does not silently expire during a live trading run. In the Notifications section, enable the Webhook URL option and paste in the webhook URL provided by your bot platform.

Step 3: Format the Webhook Message

The webhook message is a JSON payload that TradingView sends to your bot platform when the alert fires. The format required depends on the bot platform you are using — each has its own expected JSON structure. A typical message might include fields for the action (buy or sell), the trading pair, the order type (market or limit), and any additional parameters your bot needs to place the order correctly. TradingView supports dynamic placeholders in the webhook message body — for example, {{ticker}} inserts the symbol name and {{close}} inserts the closing price of the bar. This lets you build flexible, reusable alert templates that work across multiple symbols. Always test your webhook message format against your bot platform's documentation before going live.

Step 4: Test With Paper Trading First

Before connecting your TradingView alerts to a live account, run the entire setup in paper trading mode. Send test alerts, confirm they are received by your bot platform, verify the orders that would be placed match your intentions, and check that the JSON payload is being parsed correctly. Most bot platforms provide a webhook test endpoint and a trade log where you can see exactly what message was received and what action was taken. Do not skip this step — a misconfigured webhook message on a live account can result in unexpected orders at the wrong size, wrong direction, or wrong symbol. For more on safe testing before going live, see our guide on How to Test a Trading Bot Before Going Live.

Common Mistakes and How to Avoid Them

Alert Expiry

TradingView alerts have an expiry date. When an alert expires, it stops firing silently — your bot stops receiving signals without any obvious warning. Always set your alert expiry date at least six to twelve months in the future, and build a calendar reminder to renew alerts before they expire. This single mistake has caused more traders to miss live signals than almost any other configuration error.

Wrong Alert Frequency Setting

Setting the alert frequency to "Every time" instead of "Once per bar close" causes alerts to fire multiple times during a single candle, generating duplicate signals and potentially placing multiple unintended orders. For most strategies, "Once per bar close" is the correct setting. Only use "Every time" for strategies specifically designed to act on real-time intra-bar conditions.

Mismatched JSON Format

The webhook message format must exactly match what your bot platform expects. A missing comma, an extra space, or an incorrect field name will cause the bot platform to reject the message silently. Always validate your JSON payload using a JSON linter before saving the alert, and cross-reference the exact field names and structure required by your bot platform's webhook documentation.

No Confirmation That Orders Executed

Just because TradingView fired an alert does not mean the order was placed. Always set up confirmation notifications on your bot platform — email or SMS alerts that confirm each order was received and executed. This creates an audit trail and lets you catch execution failures quickly. For a complete framework on monitoring live bot activity, see our guide on How to Monitor and Maintain a Live Trading Bot.

Related Reading

How to Optimize a Trading Bot Strategy Without Over-Fitting
Momentum Trading Bots: How to Ride Market Trends With Automation
Mean Reversion Trading Bots: How They Work and When to Use Them
Scalping Bots: High-Frequency Automation Explained

Platforms That Integrate Best With TradingView Webhooks

Several bot platforms have built native TradingView webhook integration that makes the setup process significantly easier. 3Commas provides a dedicated TradingView signal bot with pre-built message templates and a visual order configuration interface. Alertatron is purpose-built for TradingView webhook automation and supports complex multi-step order sequences triggered by a single alert. WunderTrading offers one-click TradingView integration with support for multiple exchanges. For traders who want full control, a custom webhook server built in Python or Node.js can receive TradingView alerts and route them to any exchange API directly. For more on exchange compatibility, see our guide on Best Exchanges for Trading Bot Integration in 2026.

Take our Free Trading Bot Match Quiz

Not sure which platform is best for connecting TradingView alerts to automated trading? Take our free Trading Bot Match Quiz and get a personalized recommendation based on your budget, goals, and risk tolerance in under 60 seconds. We'll also send you a free e-book with honest reviews, performance stats, and red flags to avoid in the trading bot world. Whether you're just getting started with webhooks or looking to upgrade your current setup, this guide helps you make the most informed choice. Click here to take the quiz and get your free report.

Related Reading

5 Best Automated Trading Platforms
How to Backtest a Trading Strategy: A Complete Guide
Free vs Paid Trading Bots: Is It Worth Paying in 2026?
Trading Bots and Black Swan Events: What You Need to Know

Written by
Author Name
0 min read

The TradingBotExperts Editorial Team consists of traders, analysts, financial writers, and AI researchers with over a decade of combined experience in algorithmic trading and fintech. We produce research-driven content to help traders understand automated systems, evaluate trading bots, and navigate the evolving world of AI-powered investing.