Theme
Language
tradingviewwebhooktrading botfreealertsautomation

TradingView Webhook Bot: Connect Alerts to Auto-Trade for Free

TradingView Webhook Bot: Connect Alerts to Auto-Trade for Free
By fomoed TeamMarch 13, 20267 min read

TradingView has established itself as the dominant charting and analysis platform for retail and professional traders alike, with tens of millions of users building strategies on its powerful Pine Script language. The missing piece for many TradingView users has been execution — you can build extraordinarily sophisticated strategies in Pine Script, complete with custom indicators, multi-condition logic, and precise risk management, but TradingView itself doesn't execute trades on most exchanges. Webhook integration bridges this gap, allowing TradingView alerts to trigger real trades on your exchange of choice. fomoed's webhook bot makes this integration free, reliable, and straightforward to set up.

How Webhooks Work: The Technical Foundation

A webhook is, at its simplest, an HTTP POST request sent from one service to another when a specific event occurs. In the TradingView context, the event is an alert condition being met — your Pine Script strategy generates a buy or sell signal, and TradingView sends an HTTP request containing the signal details to a URL you specify. The receiving service (fomoed's webhook endpoint) parses the incoming data, validates it, and executes the corresponding trade on your connected exchange.

The data payload is a JSON object that you define in TradingView's alert message field. This payload tells fomoed what action to take: which direction to trade (long or short), what size, what order type, and any additional parameters your strategy requires. fomoed's webhook processor is designed to be flexible with payload formats — it handles various JSON structures and field names, so you don't need to conform to a rigid schema. However, using fomoed's recommended payload format ensures the most reliable and feature-complete integration.

The entire round trip — from TradingView detecting the signal to fomoed placing the order on the exchange — typically completes in under two seconds. In most market conditions, this latency is negligible. TradingView evaluates your Pine Script conditions on each candle close (or each tick, depending on your alert settings), and the webhook fires within milliseconds of the condition being met. Network transit to fomoed's servers adds minimal delay, and order placement on the exchange follows immediately.

$0Monthly Fee
10+Exchanges
7Strategies
24/7Uptime

Setting Up TradingView Alerts for Webhook Trading

The setup process begins on TradingView's alert creation dialog. When you create an alert based on your Pine Script strategy's conditions, you'll find a "Webhook URL" option in the notifications section. This is where you paste the unique webhook URL that fomoed generates for your bot. Each webhook bot on fomoed receives its own URL, so multiple bots can receive signals from different TradingView strategies simultaneously without interference.

The alert message field is where you define the JSON payload. A basic payload might look like this: the action field specifies "buy" or "sell," the ticker field confirms which asset, and the size field indicates position size as a percentage of your capital or a fixed amount. More advanced payloads can include take-profit and stop-loss levels, leverage settings, order type preferences, and custom parameters that override the bot's default configuration for specific trades.

The most common setup mistake is misformatting the JSON payload. TradingView's alert message field accepts plain text, so you need to ensure your JSON is syntactically valid — proper quotation marks, no trailing commas, correct nesting. fomoed's webhook processor provides clear error messages when it receives a malformed payload, and the bot's trade log shows every incoming webhook along with its processing status, making debugging straightforward.

Advanced Pine Script Strategies

The real power of webhook integration lies in the unlimited complexity of strategies you can build in Pine Script and execute through fomoed. While fomoed's built-in strategies cover common approaches (RSI, DCA, grid, etc.), Pine Script gives you access to TradingView's entire library of technical indicators, custom calculations, and multi-condition logic trees that would be impossible to replicate in a pre-built strategy template.

Consider a Pine Script strategy that combines RSI divergence detection, volume-weighted momentum, and multi-timeframe trend confirmation. This strategy monitors the 15-minute chart for RSI bullish divergence (price making lower lows while RSI makes higher lows), confirms that the 1-hour trend is bullish (using a combination of moving averages and ADX), and validates that the trade-day volume is above the 20-day average. Only when all three conditions align does the strategy generate a buy signal that fires the webhook. This level of multi-factor analysis would require custom coding on any automated platform, but TradingView makes it accessible through Pine Script's relatively simple syntax.

Multi-timeframe analysis is particularly valuable for webhook strategies. Pine Script's security() function allows your alert-generating code to reference data from multiple timeframes simultaneously. Your strategy might use the 4-hour chart for trend direction, the 1-hour chart for signal generation, and the 15-minute chart for entry timing. The resulting signal combines information from all three timeframes into a single, high-conviction entry point. The webhook fires only when the multi-timeframe confluence aligns, which might happen a few times per week rather than multiple times per day — but each signal carries substantial conviction.

Webhook Setup: Create a webhook bot on fomoed, copy the generated webhook URL, paste it into TradingView's alert webhook field, and configure your JSON payload in the alert message. Your TradingView strategy's signals will automatically execute as trades on your connected exchange. The entire setup takes under five minutes.

JSON Payload Format and Configuration

fomoed's webhook bot accepts JSON payloads with several recognized fields. The action field (required) accepts values like "buy," "sell," "close_long," "close_short," or "close_all." The size field (optional) specifies position size either as a percentage of available balance or an absolute amount in the quote currency. The price field (optional) specifies a limit price — if omitted, the order executes at market. Additional fields like leverage, take_profit, and stop_loss can override the bot's default settings on a per-trade basis.

This per-trade override capability is particularly powerful for dynamic strategies. Your Pine Script code can calculate optimal take-profit and stop-loss levels based on current market conditions — wider stops during high volatility, tighter stops during calm markets — and include these calculated values in the webhook payload. The bot applies these dynamic levels to each specific trade, giving you the adaptability of a manually managed position with the consistency of automated execution.

For traders running multiple webhook bots across different strategies, fomoed keeps each bot's webhook endpoint independent. A momentum strategy on BTC sends its signals to one bot's URL, while a mean-reversion strategy on ETH sends to a different bot's URL. Each bot maintains its own position, its own PnL tracking, and its own trade history. This separation makes it easy to evaluate each strategy's performance independently and shut down underperformers without affecting other bots.

Latency Considerations and Reliability

For most webhook strategies, the sub-two-second execution latency is more than adequate. Strategies based on candle closes (which is how most Pine Script strategies operate) are inherently insensitive to sub-second timing because the signal is generated based on completed candle data. Whether the order hits the exchange 500 milliseconds or 1,500 milliseconds after the candle close rarely affects the execution price meaningfully.

However, for strategies that operate on real-time ticks or require precise timing — such as news-based strategies or strategies that trigger on exact price levels — latency becomes more relevant. In these cases, there are several optimization steps you can take. First, ensure your TradingView alert is set to fire on the specific condition rather than on candle close, which reduces the delay between the event and the webhook firing. Second, use market orders rather than limit orders in your payload to ensure immediate fills. Third, prefer highly liquid pairs where the spread between the webhook fire and order execution doesn't result in significant slippage.

Reliability is another consideration for webhook-based strategies. The chain from TradingView to fomoed to the exchange involves multiple network hops, and any disruption in the chain can delay or prevent execution. TradingView occasionally experiences delays in firing webhooks during extremely high-traffic events (like flash crashes that trigger millions of alerts simultaneously). fomoed maintains high-availability infrastructure to minimize its own contribution to latency, and the system logs every incoming webhook for audit and debugging purposes.

Managing Multiple Webhook Bots

Power users often run several webhook bots simultaneously, each connected to a different TradingView strategy. A common setup might include a trend-following strategy on BTC, a mean-reversion strategy on ETH, a breakout strategy on SOL, and a custom indicator strategy on a selection of altcoins. Each strategy runs as an independent webhook bot on fomoed, with its own exchange connection, position tracking, and risk parameters.

The fomoed dashboard provides a unified view of all your webhook bots alongside any other bots you're running. You can see at a glance which bots have open positions, their current PnL, recent trades, and any webhook errors that need attention. This centralized management eliminates the need to check multiple TradingView alerts, exchange accounts, and separate bot services — everything is in one place, across all your exchanges and strategies, completely free.