Universal

TradingView Webhooks Setup Guide

Time: 10 minutes | Difficulty: Easy | Market: Universal (any market TradingView charts) Mode: Full automation | API: Webhook alerts (outbound HTTP POST) | Docs: tradingview.com/support/solutions/43000529348

This guide connects TradingView alerts to a trading bot for automated execution on any supported broker. Configure webhooks, validate signals through the gate, and route trades to Coinbase, Alpaca, or any botwir3 adapter — downloaded and run locally.


Before you start

Verify that automated operation is permitted under the destination platform's current terms of service before deploying. TradingView is a signal source, not a broker — it sends alerts. The execution target (Coinbase, Alpaca, etc.) is where platform terms apply. botwir3 provides tools for building structured automation. The user is responsible for compliance with all applicable platform terms and regulations.

TradingView Terms of Use | Last verified: May 2026

The execution target's terms of service also apply. See the specific broker's setup guide for ToS links.

What you need

  • A TradingView account with alerts (Essential plan or higher for webhook alerts)
  • The botwir3 runtime running on a machine with a public URL (or a tunnel like ngrok for testing)
  • A strategy config file from the builder
  • A configured broker adapter (Coinbase, Alpaca, or any supported platform)

Step 1: Configure the bot as a webhook receiver

Create adapter.json in the bot directory. The adapter configuration defines the webhook listener and the destination broker:

{
  "adapter": "webhook",
  "webhook_port": 3333,
  "webhook_secret": "paste-secret-passphrase-here",
  "broker_adapter": "alpaca",
  "broker_credentials": {
    "api_key": "paste-broker-api-key-here",
    "api_secret": "paste-broker-api-secret-here",
    "base_url": "https://paper-api.alpaca.markets"
  },
  "rate_limit_ms": 0
}

webhook_port: The port the bot listens on. Default 3333.

webhook_secret: A passphrase included in the TradingView alert payload. Incoming requests without this value are not processed. Set it to a random string.

broker_adapter + broker_credentials: The destination where trades execute. Can be any supported adapter (coinbase, alpaca, binance, kraken, ibkr, schwab).

rate_limit_ms: Set to 0. The bot does not poll — it waits for incoming webhooks.

API keys are stored in a local config file on the machine running the bot. They are not transmitted to botwir3 or any third party. botwir3 never sees, stores, or has access to platform credentials.

🔒 Security. The webhook endpoint is protected by the webhook_secret value. Only requests containing the correct secret are processed. Use HTTPS in production.

Step 2: Start the bot

botwir3 start --config my-strategy.json

Expected output:

[botwir3] Adapter: webhook
[botwir3] Listening on port 3333
[botwir3] Broker adapter: alpaca
[botwir3] Waiting for incoming signals...

For testing, use ngrok to expose the local port:

ngrok http 3333

Note the public URL (e.g., https://abc123.ngrok.io). This is the webhook URL for TradingView.

Step 3: Create a TradingView alert

  1. Open a chart on TradingView
  2. Click Alert (clock icon) or press Alt+A
  3. Set the alert condition (indicator cross, price level, custom Pine Script condition)
  4. Under Notifications, enable Webhook URL
  5. Enter the bot's public URL: https://your-server.com:3333/webhook
  6. In the Message field, enter the signal payload:
{
  "secret": "paste-secret-passphrase-here",
  "ticker": "{{ticker}}",
  "action": "{{strategy.order.action}}",
  "price": "{{close}}",
  "time": "{{time}}"
}

TradingView replaces {{ticker}}, {{strategy.order.action}}, {{close}}, and {{time}} with live values when the alert fires.

Step 4: Verify the connection

Trigger a test alert in TradingView (or wait for the condition to fire). The bot logs incoming signals:

[botwir3] Webhook received: BUY AAPL @ 187.42
[botwir3] Gate: evaluating against spec...
[botwir3] Gate: PASS — within configured band
[botwir3] Submitting to broker adapter: alpaca

The runtime receives the signal, and the gate function compares the proposed action against the configured spec. The user is responsible for monitoring the bot and verifying execution outcomes.

Rate limits and considerations

ComponentLimitNotes
TradingView alertsPlan-dependentEssential: 20 active alerts. Plus/Premium: more.
Webhook delivery~1 second latencyTradingView sends HTTP POST when condition fires
Broker executionBroker-dependentSee the specific broker's setup guide for rate limits

Signal routing. TradingView generates the signal. botwir3 validates it against the configured spec. The broker adapter executes it. Each layer operates independently — changing the broker adapter does not require reconfiguring TradingView alerts.

Production deployment. Reliable webhook reception requires a server with a static IP or domain name. Ngrok is for testing only — ngrok URLs change on restart. VPS providers (DigitalOcean, Linode, Hetzner) or a home server with port forwarding and a domain work for production.

HTTPS. Production deployments use a reverse proxy (nginx, Caddy) with TLS. TradingView sends webhooks over HTTPS when the URL starts with https://.

Common TradingView webhook bot configurations include Pine Script indicator crossovers routed to a crypto exchange, multi-timeframe confirmation strategies on equities, and alert-driven position management across any market TradingView charts. One webhook setup covers every asset class — change the broker adapter without changing the TradingView alert.

Troubleshooting

ErrorCauseFix
CONNECTION_REFUSEDBot not running or port not reachableVerify the bot is running and the port is open (firewall, ngrok)
INVALID_SECRETWebhook secret mismatchVerify the secret field in the TradingView alert message matches webhook_secret in adapter config
BROKER_ERRORBroker adapter returned an errorCheck broker credentials and permissions. See the broker's setup guide.
RATE_LIMITEDBroker rate limit exceededIncrease the broker adapter's rate_limit_ms
MANDATE_INTEGRITY_VIOLATIONConfig file modified while bot is runningStop the bot, verify config, restart

All actions — including webhook receipts, gate evaluations, and broker submissions — are recorded in the local ledger.

Related guides


One bot. $129. No subscription. No $749/mo platform. → Build for TradingView


Build your TradingView Webhooks bot

Ready to build?