Legacy · TradingView
Webhook Reference (Legacy)
Legacy TradingView path. Native compiled deployment does not use these webhooks — see Live deployment.
Reference for JSON alert messages sent from TradingView to RoboQuant.
Endpoint: POST https://trading-api.roboquant.dev/webhook/{token}
Your personal {token} is shown in the dashboard Webhooks tab.
Minimal payload
{
"symbol": "ES",
"side": "buy",
"quantity": 1
}
Full field reference
| Field | Type | Required | Description |
|---|---|---|---|
symbol | string | Yes | Trading symbol. Use {{ticker}} from TradingView |
side | string | Yes* | buy, sell, close, or cancel_all |
action | string | Yes* | TradingView alias for side (lowercased on ingest) |
quantity | number | No | Order size. Falls back to connection default |
qty | number | No | Alias for quantity |
contracts | number | No | Futures alias for quantity |
order_type | string | No | market (default) or limit |
price | number | No | Required for limit orders |
accountId | string/number | No | Single Tradovate account |
accountIds | array | No | Multiple Tradovate accounts |
accounts | array | No | Per-account configs (see below) |
connectionId | string | No | Single crypto connection UUID |
connectionIds | array | No | Multiple crypto connections |
exchange | string | No | Crypto broker type (binance, bybit, etc.) |
quantityMultiplier | number | No | Multiply default qty |
fixedQuantity | number | No | Override qty |
stopLoss | number | No | Stop loss distance/value |
takeProfit | number | No | Take profit distance/value |
stopLossType | string | No | SL calculation mode |
takeProfitType | string | No | TP calculation mode |
riskPercent | number | No | Risk-based sizing (indicator mode) |
*Either side or action must be present.
Strategy alert template
Generated by RoboQuant for Tradovate strategy deployment:
{
"accountId": 12345678,
"symbol": "{{ticker}}",
"side": "{{strategy.order.action}}",
"quantity": "{{strategy.order.contracts}}",
"price": "{{strategy.order.price}}"
}
Indicator alert template
{
"accountId": 12345678,
"symbol": "{{ticker}}",
"side": "buy",
"quantity": 1,
"price": "{{close}}"
}
Multi-account example
{
"symbol": "{{ticker}}",
"side": "{{strategy.order.action}}",
"quantity": "{{strategy.order.contracts}}",
"accounts": [
{ "accountId": 111, "quantityMultiplier": 1.0 },
{ "accountId": 222, "fixedQuantity": 2 }
]
}
TradingView variables
Strategy variables
| Variable | Description |
|---|---|
{{strategy.order.action}} | buy or sell |
{{strategy.order.contracts}} | Order quantity |
{{strategy.order.price}} | Order price |
{{strategy.position_size}} | Current position size |
Price & symbol
| Variable | Description |
|---|---|
{{ticker}} | Chart symbol |
{{close}} | Bar close |
{{open}} | Bar open |
{{high}} | Bar high |
{{low}} | Bar low |
{{time}} | Bar timestamp |
Plot variables (indicators)
| Variable | Description |
|---|---|
{{plot_0}} … {{plot_19}} | Values from plot() calls in script order |
Side normalization
The connector lowercases side and accepts:
buy— open/increase long or buy to coversell— open/increase short or sell longclose— flatten positioncancel_all— cancel working orders
Response behavior
- Valid token + payload → order routed to configured broker(s)
- Results logged to webhook order logs in dashboard
- Async mode may return
202 Acceptedwithalert_idfor queue processing
Security notes
- Never share your webhook URL publicly — it contains your secret token
- Rotate token if exposed (regenerate in dashboard)
- Use symbol whitelist and kill switch for production accounts
- Test on paper / sim account first
Related
- TradingView deployment — full setup guide
- Pine strategies — Pine order functions
- Pine indicators — plot variables