Trading

TradingView Webhooks

9 min read

What it is

Pipe TradingView Pine Script alerts directly into haythix. When your indicator fires, haythix either drops the alert into your notification feed or places a real market order on a connected exchange — whichever mode you picked when you created the webhook.

How to think about it

TradingView is where most chart-based strategies live. This integration bridges any Pine Script alert (RSI cross, EMA breakout, custom indicator) to either a notification or a live trade on your connected CEX, so your strategy executes while you sleep.

Step-by-step

  1. Create a webhook in haythix

    Trade → TradingView Webhooks → Create Webhook. Step 1: name + description + action mode. Two modes: "Just notify me" (logs to your notification feed, no trade) or "Execute a trade automatically" (queues a real market order on your connected exchange). Start with notify-only.

  2. Pick exchange + default amount (execute mode only)

    Step 2 only shows if you picked execute mode. The exchange dropdown lists ONLY exchanges you have actually connected — no fake options. Default amount is used when the TradingView alert payload omits an explicit amount field. For Coinbase market buys, this is interpreted as USD spend (e.g., 25 = $25); for sells or other exchanges, as base-asset quantity.

  3. Copy the webhook URL + shared secret

    After Create, haythix shows the URL (e.g., api.haythix.com/api/webhook/tradingview/tv_abc123) and a shared secret. The URL is the destination for TradingView; the secret goes inside the JSON message body. Both must be treated as private — anyone with both can trigger your alerts.

  4. Configure the TradingView alert

    In TradingView, open the alert dialog → Notifications tab → Webhook URL field → paste the haythix URL. Then in the Message field, paste the JSON template haythix generated for you. It already contains the shared secret, action (buy/sell), symbol, and placeholders like {{close}} for price and {{ticker}} for the pair.

  5. Test before going live

    Back in haythix, click Send Test Alert on the webhook card. The button simulates a real TradingView fire and you should see a row appear under Recent Alerts within 1-2 seconds. If notify mode shows "received", you are wired correctly. If execute mode shows "queued", the executor worker will pick it up within 60 seconds.

  6. Watch the first few real fires

    Once the TradingView alert fires for real, check Recent Alerts to confirm the payload arrived intact. Execute-mode fires also appear in your CEX Trading → Order History after the worker drains the queue. The Received / Successful / Failed counters on the webhook card update live.

Tips & pitfalls

  • Shared secret is mandatory in execute mode — without it the webhook will reject the alert. Notify mode is more forgiving but you still should include it; otherwise anyone who guesses your webhook key can spam your notification feed.
  • Auto-execute fires REAL orders with NO manual confirmation. The executor drains the queue every 60 seconds — once a payload is in, it WILL trade. Always validate JSON in notify mode for at least one day before flipping the same alert to execute.
  • Default amount only applies when the alert payload omits "amount". If you send "amount": 50 in the JSON, it overrides the default. Useful for indicator-driven position sizing.
  • Coinbase market buy quirk: Coinbase expects USD spend for market BUYs (not base quantity). haythix handles this transparently — when actionMode=execute_trade and exchange=coinbase and side=buy, the amount field is treated as USD. For Binance US it is treated as base asset.
  • The Recent Alerts log shows the exact JSON TradingView sent us. If a fire fails, the error message tells you what was missing (bad secret, unknown symbol, no connected exchange, insufficient balance). Read it before re-running.
  • Webhook ACTIVE toggle is your kill switch. Flip a webhook to INACTIVE and TradingView fires are accepted but ignored — useful when you want to pause a strategy without deleting the webhook in TradingView.
  • Delete a webhook and the URL stops working immediately. TradingView alerts pointed at it will fail silently from TradingView side — remember to disable or repoint those alerts.