Transform technical signals into automated trades using TradingView alert conditions. Master webhooks, JSON payloads, and testing for flawless execution.

TradingView alert conditions are the trigger criteria you define within TradingView that determine when an alert fires and sends a signal to your automation platform or broker. Setting up alert conditions properly involves selecting specific price levels, indicator crossovers, or strategy signals in TradingView's alert creation interface, then configuring the webhook URL to transmit that alert data for automated trade execution. The accuracy of your alert conditions directly determines whether your automated trades execute at the right time with the correct parameters.
Alert conditions are the specific criteria you configure in TradingView that determine when an alert fires and sends a notification or webhook message. These conditions can be based on price crossing a specific level, an indicator reaching a threshold, a moving average crossover, or custom Pine Script logic. When properly connected through a webhook URL, these alert conditions trigger automated execution through platforms that support TradingView automation.
TradingView supports alert conditions from multiple sources including built-in indicators, custom indicators, drawing tools like horizontal lines and trend lines, and Pine Script strategies. The platform evaluates these conditions in real-time during market hours and can fire alerts once per bar close or continuously as conditions are met.
Alert Condition: A user-defined trigger rule in TradingView that fires when specific price, indicator, or strategy criteria are met. Alert conditions form the foundation of automated trading by determining exactly when trades execute.
For futures traders, alert conditions typically focus on Opening Range breakouts, indicator divergences, or strategy-generated signals that identify entry and exit points. Accurate alert condition configuration is critical because these triggers directly control when your capital is deployed in live markets.
Creating alert conditions in TradingView starts with clicking the clock icon in the top toolbar or right-clicking on an indicator and selecting "Add Alert." The alert creation dialog presents condition options based on what you clicked—price levels show crossing options, indicators show value thresholds, and strategies show order fill events.
The condition field is where you define your trigger logic. For a simple moving average crossover, you'd select "Moving Average (20)" from the first dropdown, "Crossing" from the operator dropdown, and "Moving Average (50)" from the second dropdown. More complex conditions can be built using Pine Script's alertcondition() function, which allows multiple criteria combined with logical operators.
Alert frequency determines how often TradingView evaluates and fires your condition. "Once Per Bar Close" waits for the candle to complete before triggering, reducing false signals but adding delay. "Only Once" fires a single time when conditions are met, useful for one-time notifications. For automation, "Once Per Bar Close" is generally preferred because it confirms the signal rather than reacting to intrabar price noise.
Expiration settings control how long your alert remains active. For ongoing automated trading, select "Open-ended" so alerts continue firing indefinitely. For backtested strategies with specific date ranges, set an expiration date matching your testing period.
A webhook URL is the connection point between TradingView alerts and your automation platform or broker API. When an alert fires, TradingView sends an HTTP POST request to this URL containing your alert message and any JSON payload you've configured. The receiving platform parses this data and executes the corresponding trade order through your broker's API.
Webhook: An automated HTTP callback that sends data from one application to another when a trigger event occurs. In trading automation, webhooks transmit alert data from TradingView to execution platforms in milliseconds.
To add a webhook URL to your TradingView alert, scroll to the "Notifications" tab in the alert creation dialog. Check the "Webhook URL" box and paste your automation platform's webhook endpoint. This URL is unique to your account and typically looks like https://platform.com/webhook/abc123xyz. Check your automation platform's documentation or dashboard for your specific webhook URL.
The message field below the webhook URL is where you construct your JSON payload. This structured data tells your automation platform what action to take—buy or sell, which instrument, how many contracts, and any additional parameters like stop loss or take profit levels. Platforms like ClearEdge Trading provide webhook URLs and JSON templates specific to supported brokers.
Webhook ComponentPurposeExampleEndpoint URLDestination for alert datahttps://api.platform.com/webhook/user123JSON PayloadOrder parameters{"action":"buy","symbol":"ES","qty":1}AuthenticationSecurity tokenEmbedded in URL or payload
The JSON payload in your TradingView alert message contains the order details that your automation platform needs to execute trades. A basic payload includes action (buy/sell), symbol (ES, NQ, GC, CL), and quantity, formatted as key-value pairs. More advanced payloads include order types, stop losses, take profits, and conditional logic.
Here's a basic JSON structure for an ES long entry: {"action":"buy","symbol":"ES","quantity":1,"orderType":"market"}. When TradingView fires this alert, the automation platform receives this data, validates it, and submits a market order to buy one ES contract through your connected broker.
For strategies with risk management, expand the JSON to include protective stops: {"action":"buy","symbol":"ES","quantity":1,"stopLoss":4900,"takeProfit":4925}. The stopLoss and takeProfit values represent specific price levels where those orders will be placed after the entry fills.
You can use TradingView's placeholder variables like {{close}}, {{high}}, or {{ticker}} to dynamically insert chart data into your JSON. For example: {"action":"buy","symbol":"{{ticker}}","entry":"{{close}}","stop":"{{close}}-4"} automatically calculates a 4-point stop based on the closing price that triggered the alert.
Testing alert conditions before live trading is critical to validate trigger accuracy and avoid costly errors from false signals or misconfigured parameters. TradingView's Strategy Tester allows you to backtest Pine Script strategies with alert conditions to see exactly when they would have fired historically and what the resulting performance would have been.
For indicator-based alerts without a formal strategy, use the Alert History panel (clock icon → "Alert History" tab) to review when alerts fired in real-time on a demo or paper trading account. This shows you whether your conditions trigger too frequently, too rarely, or at appropriate moments based on your trading plan.
Create a paper trading account with your broker or use a platform's simulation mode to test the complete workflow—TradingView alert fires, webhook transmits JSON, platform receives data, order executes in simulation. Monitor execution logs to confirm orders match your alert conditions exactly. Common issues discovered during testing include incorrect symbol formatting, quantity miscalculations, or timing delays during high-volatility periods.
Run your alert conditions for at least 20-30 triggered instances in simulation before risking real capital. This sample size reveals whether your logic is sound or if you're getting premature triggers from intrabar price movement, indicator repainting, or webhook transmission failures.
Using "Once Per Bar" instead of "Once Per Bar Close" is one of the most frequent errors. "Once Per Bar" fires alerts continuously while conditions are true within a bar, potentially sending dozens of duplicate orders before the candle completes. "Once Per Bar Close" waits for the bar to finish, confirming the signal.
Forgetting to account for broker symbol formatting causes execution failures. TradingView might use "ES1!" for continuous E-mini S&P contracts, but your broker API may require "ES" or "ESM4" for the specific contract month. Always verify your automation platform's required symbol format and test with small positions first.
Setting alerts on indicators that repaint—recalculating historical values as new bars form—leads to backtest results that don't match live performance. Indicators using security() functions with lookahead bias or non-confirmed data sources will show perfect backtest performance but fail in real-time. Test indicators specifically for repainting by watching whether historical bars change values as new data arrives.
Neglecting to set position sizing limits in your JSON payload or platform settings allows alerts to potentially open unlimited contracts. A rapid succession of alert triggers during volatile conditions could stack positions beyond your risk tolerance. Always define maximum position sizes and daily order limits.
You can create alerts from most built-in and custom indicators that plot values on the chart, but the indicator must explicitly expose alert conditions through its Pine Script code using alertcondition(). Some indicators only provide visual information without programmatic alert functionality, requiring you to use drawing tools or price levels instead.
TradingView limits total active alerts based on your subscription tier—Essential (1 alert), Plus (10 alerts), Premium (30 alerts), and Ultimate (400 alerts). For futures automation across multiple instruments and timeframes, Premium or Ultimate tiers are typically required to handle the alert volume needed for comprehensive strategy coverage.
TradingView will attempt to send the alert to the webhook URL but will fail silently if the endpoint is unreachable or returns an error. Your alert will show as fired in Alert History, but no trade will execute because the automation platform never received the data. Most platforms log webhook failures so you can diagnose connection issues.
Yes, TradingView evaluates alert conditions 24/5 for futures contracts that trade nearly continuously like ES, NQ, GC, and CL. Alerts will fire during overnight sessions (6pm-9:30am ET) and regular hours (9:30am-4pm ET) as long as your chart is set to the 24-hour session template rather than regular hours only.
No, TradingView does not allow editing existing alerts. You must delete the old alert and create a new one with corrected parameters. This prevents accidental modification of live trading alerts but requires careful initial setup and thorough testing before activation.
Proper TradingView alert condition setup forms the foundation of reliable automated futures trading. By defining precise trigger criteria, connecting webhook URLs correctly, structuring JSON payloads with accurate parameters, and thoroughly testing before live execution, you create a system that executes your strategy without manual intervention.
Start with paper trading to validate your alert conditions across multiple market scenarios. Once you've confirmed trigger accuracy and execution reliability over 20-30 test instances, transition to live trading with reduced position sizing until your automation proves consistent.
Ready to automate your TradingView strategies? Read our complete TradingView automation guide for detailed webhook setup and strategy implementation.
Disclaimer: This article is for educational and informational purposes only. It does not constitute trading advice, investment advice, or any recommendation to buy or sell futures contracts. ClearEdge Trading is a software platform that executes trades based on your predefined rules—it does not provide trading signals, strategies, or personalized recommendations.
Risk Warning: Futures trading involves substantial risk of loss and is not suitable for all investors. You could lose more than your initial investment. Past performance of any trading system, methodology, or strategy is not indicative of future results. Before trading futures, you should carefully consider your financial situation and risk tolerance. Only trade with capital you can afford to lose.
CFTC RULE 4.41: HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY.
By: ClearEdge Trading Team | About
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Block quote
Ordered list
Unordered list
Bold text
Emphasis
Superscript
Subscript
Every week, we break down real strategies from traders with 100+ years of combined experience, so you can skip the line and trade without emotion.
