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.
How It Works
Section titled “How It Works”Understanding the data flow is essential for troubleshooting:
- Trigger: Your Pine Script strategy fires an alert condition (e.g., “Buy Signal”).
- Payload: TradingView sends a JSON packet containing trade details (ticker, action, price).
- Authentication: Our server verifies the
auth_keyin the payload matches your specific webhook endpoint. - Ingestion: If valid, the system creates a TradeWebhookEvent record.
- Processing: The event is parsed into a TradeOrder record for analytics, matching, and post-hoc report review.
Step 1: Create a Connection
Section titled “Step 1: Create a Connection”- Navigate to Dashboard > Webhooks.
- Click Create Webhook.
- Give it a recognizable name (e.g., “BTC Strategy”).
- Copy the generated Webhook URL and Auth Key. You will need these for TradingView.
Step 2: Configure TradingView Alert
Section titled “Step 2: Configure TradingView Alert”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:
- Webhook URL: Paste the URL you copied from the dashboard.
- 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" }}Step 3: Limitations & Best Practices
Section titled “Step 3: Limitations & Best Practices”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
429until 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.
Troubleshooting
Section titled “Troubleshooting”- 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”.
Next Steps
Section titled “Next Steps”Once your webhooks are flowing:
- Verify Data: Check the raw logs to ensure TradingView is sending what you expect.
- Backtest vs Alerts: Compare these real-time signals against your historical backtest.
- Standard Reference: View the full list of supported JSON fields.