Skip to main content

Setting up TradingView Webhooks

Use your own TradingView Pine Script strategy and let Hextrade automatically execute orders on your connected broker accounts. No code changes required on your broker side — just set the webhook URL and use the correct JSON format.

Supported Platforms for Webhooks

ProjectX

Futures trading on ProjectX via TradingView webhook.

Tradovate

Futures on Tradovate. Set platformType to tradovate.

Alpaca

Equities on Alpaca. Set platformType to alpaca.

DxTrade

Multi-asset via DxTrade. Set platformType to dxtrade.

Tradier

Equities and options via Tradier. Set platformType to tradier.

More coming

Additional platforms added regularly. Check Discord for updates.

TradingView Webhook JSON Format

When creating a TradingView alert, use the following JSON in the alert message. Hextrade will parse this and place the corresponding order on your connected broker.
{
"ticker": "NQ",
"action": "{{strategy.order.action}}",
"sentiment": "{{strategy.market_position}}",
"quantity": "{{strategy.order.contracts}}",
"price": "{{close}}",
"platformType": "projectx",
"accountId": "your_account_id",
"tp": "100",
"sl": "20"
}
tp (Take Profit) and sl (Stop Loss) values are calculated in ticks, not dollars. Ensure these match your instrument’s tick size.

️ Field Mapping: TradingView → Hextrade API

TradingView FieldHextrade API FieldDescription
tickersymbolThe instrument symbol (e.g. NQ, ES, AAPL)
actionsideOrder side — buy or sell
sentimentsentimentMarket position (long, short, flat)
quantityquantityNumber of contracts or shares
pricepriceEntry price (use {{close}} for market)
tptpTake profit in ticks
slslStop loss in ticks

Required Fields

Every webhook payload must include:
FieldDescription
platformTypeThe broker — projectx, tradovate, alpaca, dxtrade, tradier, etc.
accountIdYour account ID from the Accounts page.
symbol or tickerThe instrument to trade.
quantityNumber of contracts or shares.
side or actionbuy or sell.

Setting Up the Webhook in TradingView

1

Get your Webhook URL

Visit dash.hextrade.io/accounts and open the Webhooks section.Copy your unique Hextrade webhook URL — it looks like:
https://api.hextrade.io/webhook/your-unique-token
2

Open your Pine Script strategy in TradingView

In TradingView, open the chart where your strategy is applied. Click “Add Alert” (or right-click → Add Alert).
3

Configure the alert

  • Condition — Select your strategy and the trigger condition (e.g. strategy.order.action).
  • Webhook URL — Paste your Hextrade webhook URL.
  • Message — Paste the JSON payload (from the template above). Replace your_account_id with your actual account ID from the Accounts page.
4

Customize the JSON for your instrument

Adjust the following fields:
  • "platformType" — Set to your broker (e.g. "projectx", "alpaca").
  • "accountId" — Your account ID.
  • "ticker" — Your instrument (e.g. "NQ", "ES", "AAPL").
  • "tp" and "sl" — Take profit and stop loss in ticks (optional).
5

Save and test the alert

Save the alert. The next time your strategy fires a signal, Hextrade will receive the webhook and execute the order on your connected broker.
Test with a small quantity (e.g. 1 micro contract) first to confirm the webhook is working correctly before scaling up.
Setting up TradingView webhooks on Hextrade

Example Payloads

ProjectX — NQ Futures

{
"ticker": "NQ",
"action": "{{strategy.order.action}}",
"sentiment": "{{strategy.market_position}}",
"quantity": "{{strategy.order.contracts}}",
"price": "{{close}}",
"platformType": "projectx",
"accountId": "your_account_id",
"tp": "100",
"sl": "20"
}

Alpaca — AAPL Equities

{
"ticker": "AAPL",
"action": "{{strategy.order.action}}",
"quantity": "{{strategy.order.contracts}}",
"price": "{{close}}",
"platformType": "alpaca",
"accountId": "your_account_id"
}

Tradovate — ES Futures

{
"ticker": "ES",
"action": "{{strategy.order.action}}",
"sentiment": "{{strategy.market_position}}",
"quantity": "{{strategy.order.contracts}}",
"price": "{{close}}",
"platformType": "tradovate",
"accountId": "your_account_id",
"tp": "50",
"sl": "15"
}

Troubleshooting

IssueSolution
Webhook fires but no order placedCheck accountId — must match exactly from the Accounts page.
platformType errorUse lowercase: projectx, tradovate, alpaca, dxtrade, tradier.
tp/sl not workingThese are in ticks, not dollars. Verify tick size for your instrument.
Alert not triggeringEnsure the TradingView alert is active and the strategy is on the chart.
Order rejected by brokerCheck account balance, position limits, and broker-side trading hours.
TradingView alerts have a delivery delay of up to a few seconds. For highly time-sensitive strategies, account for this latency. Always monitor the first few live executions carefully.

Security

  • Your webhook URL contains a unique token — keep it private.
  • Do not share your webhook URL publicly (e.g. in Discord or GitHub).
  • If compromised, regenerate your token from the Accounts page.