Latest Release v3.3.0b released on 2026-05-16 View News ›

TradingView Webhooks

This guide walks you through connecting TradingView alerts to your Tradleware instance so that your Pine Script strategies automatically trigger live orders on your exchange.


How It Works

TradingView Alert
      │  (HTTPS POST with JSON payload)

Tradleware Webhook Endpoint
      │  (validates api_key, trader_id, ticker)

Exchange API (OKX / Crypto.com / IR / IBKR)

Every TradingView alert fires a POST request to your Tradleware webhook URL. Tradleware validates the payload, routes it to the correct bot, and executes the order.


Prerequisites

  • A running Tradleware instance (Setup guide)
  • A TradingView account (free or paid — webhooks require a Pro plan or higher)

Step 1 — Get Your Webhook Details from the Dashboard

You don’t need to dig through config files — the dashboard surfaces everything you need.

Webhook URL (shared across all bots)

The footer of the Tradleware dashboard shows your full webhook endpoint URL — the same base URL used by every bot:

http://YOUR_SERVER_IP:8080/YOUR_WEBHOOK_PATH

This is the URL you will paste into TradingView.

Per-bot API key and ready-to-use payload

Each bot has its own card on the dashboard. Expand the Webhook Details pane on the bot’s card to find:

  • The bot’s tradleware_api_key (the per-bot auth secret)
  • A pre-filled JSON payload you can copy directly into TradingView
  • A live Test button to fire a dry_run webhook without leaving the UI

Important: TradingView requires your webhook URL to be publicly reachable. If Tradleware is on a home server you will need one of:

  • A domain with DNS pointed to your IP + port forwarding on your router, or
  • A reverse proxy (e.g. Nginx) in front of Tradleware, or
  • A tunnel service (e.g. Cloudflare Tunnel) for a zero-port-forward setup
Webhook Details pane on a bot card

Step 2 — Create the Alert in TradingView

  1. Open a chart with your strategy applied
  2. Click the Alerts icon (clock) in the right toolbar
  3. Click Create Alert
  4. Set the Condition to your strategy’s entry/exit signals
  5. Under Notifications, enable Webhook URL
  6. Paste your Tradleware webhook URL
  7. Set the Message field to the JSON payload (see below)

Step 3 — The Webhook JSON Payload

Paste this into the TradingView alert Message field, customized for your bot:

{
  "api_key": "SOME_RANDOM_PER_BOT_KEY",
  "trader_id": "mybtcbot",
  "ticker": "BTC/USDT",
  "action": "{{strategy.order.action}}",
  "timestamp": {{timenow}},
  "alert_name": "{{alertname}}",
  "order_size": 10,
  "order_size_type": "percentage",
  "dry_run": false
}

Field reference

FieldDescription
api_keyYour bot’s tradleware_api_key from YAML
trader_idThe id of your bot in YAML (lowercase)
tickerMust match crypto_stablecoin_pair in your YAML exactly
action"buy" or "sell" — use {{strategy.order.action}} to auto-fill
timestampUse {{timenow}} for TradingView’s current Unix timestamp
order_size0–100 for percentage, or exact quantity
order_size_type"percentage" or "quantity"
dry_runtrue to simulate without executing; false for live trades

Step 4 — Pine Script Integration

To fire buy/sell alerts from a Pine Script strategy, use strategy.entry and strategy.close:

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

longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))

if longCondition
    strategy.entry("Buy", strategy.long)

if shortCondition
    strategy.close("Buy")

When you create the alert for this strategy, TradingView will call your webhook on each strategy.entry and strategy.close with {{strategy.order.action}} resolving to "buy" or "sell" automatically.


Step 5 — Test Before Going Live

Always test with dry_run: true first:

  1. Set "dry_run": true in your alert message payload
  2. Trigger the alert manually in TradingView (right-click the alert → Trigger)
  3. Check your Tradleware dashboard — you should see the simulated order logged
  4. Once confirmed, update the payload to "dry_run": false

Troubleshooting

IssueFix
Alert fires but no log entryCheck your webhook URL — TradingView requires HTTPS for external URLs
401 UnauthorizedVerify api_key matches the bot’s tradleware_api_key in YAML
trader_id not foundEnsure the id in your YAML is lowercase and matches exactly
ticker mismatchticker must match crypto_stablecoin_pair character-for-character