Skip to content
Algo Trade Analytics Docs

Webhook Integration

The critical link between your TradingView strategy and real-time analytics.

Webhooks allow TradingView to push signals instantly to our platform. This guide covers configuration, authentication, and payload requirements.

Understanding the data flow is essential for troubleshooting:

  1. Trigger: Your Pine Script strategy fires an alert condition (e.g., “Buy Signal”).
  2. Payload: TradingView sends a JSON packet containing trade details (ticker, action, price).
  3. Authentication: Our server verifies the auth_key in the payload matches your specific webhook endpoint.
  4. Ingestion: If valid, the system creates a TradeWebhookEvent record.
  5. Processing: The event is parsed into a TradeOrder record for analytics, matching, and post-hoc report review.

  1. Navigate to Dashboard > Webhooks.
  2. Click Create Webhook.
  3. Give it a recognizable name (e.g., “BTC Strategy”).
  4. Copy the generated Webhook URL and Auth Key. You will need these for TradingView.

If your strategy already lives in Algo Lab, use the Webhook action in the Editor tab to ask the Algo Agent to add the payload inputs and alert_message wiring directly to the same strategy script. This keeps the backtest logic and live alert payloads together.

In your TradingView strategy settings or alert dialog:

  1. Webhook URL: Paste the URL you copied from the dashboard.
  2. Message: You must send a valid JSON object. Use our standard template:
{
"auth_key": "YOUR_AUTH_KEY_HERE",
"ticker": "{{ticker}}",
"positionDirection": "entryLong",
"orderType": "market",
"qty": {{strategy.order.contracts}},
"marketPrice": {{close}},
"metadata": {
"timestamp": "{{timenow}}",
"strategy": "My Strategy",
"signal": "Buy Signal"
}
}

To ensure system stability and accurate processing:

  • Rate Limits: New webhook connections default to 30 requests per 60-second window. The window and maximum are stored per connection, so check the product if the values have been changed. High-frequency trading (HFT) is not supported.
  • Plan Limits: The number of endpoints and the monthly events per endpoint depend on your plan (see the pricing page for current numbers). Deliveries past a cap return 429 until the next month or an upgrade.
  • One Strategy, One Webhook: We recommend creating a separate webhook connection for each distinct strategy. This makes debugging much easier if one strategy starts misbehaving.
  • Payload Size: JSON bodies are capped at 128 KB. Keep payloads focused on the signal and its reconciliation metadata.
  • 401 Error: Check your auth_key. It must be an exact string match.
  • 429 Error: Either the endpoint reached its monthly events cap, or the endpoint is paused because it is over your plan’s active-endpoint limit — the response message says which. Free a slot by deactivating another endpoint, wait for the next monthly cycle, or upgrade.
  • No Event: Verify you checked the “Webhook URL” box in TradingView alert options.
  • Event but No Trade: Check the Webhook Events Log. If the JSON was malformed, the system creates an event but marks it as “Failed to Process”.

Once your webhooks are flowing: