TradingView webhooks
Send TradingView alerts to Coinrule to trigger your strategy entries and exits.
TradingView can send HTTP alerts to Coinrule when your indicator or strategy conditions fire. Coinrule receives the alert, verifies the webhook secret, and dispatches a buy or sell signal to your strategy. Setup takes four steps: create the strategy, launch it, generate a secret, then configure the TradingView alert.
How do I set up the integration?
- Create a webhook strategy on Coinrule — describe it as "fire when I receive a TradingView signal" or similar. The strategy uses the
WebhookSignal()indicator. - Launch the strategy. The webhook secret is generated after launch.
- Open the TradingView panel on the strategy detail page. Click Generate to create a secret and copy the webhook URL.
- Set up the alert in TradingView: paste the webhook URL and set the alert message to the JSON payload shown in the panel.
The webhook secret is generated after launch, not before. You must launch the strategy first, then configure TradingView.
Webhook facts
| Property | Value |
|---|---|
| Endpoint | POST /api/webhooks/tradingview/:strategyId |
| Rate limit | 30 signals per 60 seconds per strategy |
| Credit cost | 1 credit per accepted signal |
| Auth | secret field in body (constant-time compare) or X-Coinrule-Signature HMAC header |
| Invalid secret response | 404 (anti-enumeration) |
What payload modes are supported?
Strategy mode (recommended for Pine Script strategies):
{
"id": "{{timenow}}-{{ticker}}",
"secret": "<your-secret>",
"symbol": "{{ticker}}",
"side": "{{strategy.order.action}}",
"price": "{{close}}"
}Simple mode (for indicator alerts):
{
"secret": "<your-secret>",
"side": "buy"
}The side field accepts: buy, sell, open_long, close_long, open_short, close_short, and equivalents.
How do I rotate the webhook secret?
On the strategy detail page → TradingView panel → Rotate. The old secret is immediately invalid. Update the alert message in TradingView with the new secret.
See Webhook payloads and secrets for full payload and security details.