Skip to main content

TradingView Integration

Connect TradingView alerts to UTM for automated trade execution.

Overview​

UTM can receive alerts from TradingView and automatically execute trades based on your strategy signals.

Setup​

1. Create an API Key​

  1. Navigate to Settings > API Keys in UTM
  2. Click Create API Key
  3. Select the signals:write scope
  4. Copy the generated key

2. Configure TradingView Alert​

In TradingView, create an alert with:

Webhook URL:

https://api.universaltrademanager.com/api/v1/signals

Message (JSON):

{
"symbol": "{{ticker}}",
"action": "openLong",
"accountId": "your-account-id",
"quantity": 100,
"executeMode": "immediate"
}

3. Add Headers​

TradingView Pro+ supports custom headers. Add:

X-API-Key: your-api-key
Content-Type: application/json

Alert Message Variables​

Use TradingView placeholders in your alert message:

PlaceholderDescription
{{ticker}}Symbol (e.g., AAPL)
{{close}}Current price
{{time}}Alert timestamp
{{interval}}Chart timeframe

Required fields in every payload​

All signals must include accountId, strategyId, and sourceId alongside the trade fields. List your strategies via GET /api/v1/strategies; every account starts with a built-in Manual strategy you can use if you do not yet have a specific one. sourceId is your idempotency key — pick a stable value per logical alert (the examples below use TradingView's built-in placeholders to build one).

Example Strategies​

Simple Long Entry​

{
"accountId": "your-account-id",
"strategyId": "your-strategy-id",
"sourceId": "tv-{{strategy.short_name}}-{{ticker}}-{{time}}",
"symbol": "{{ticker}}",
"action": "openLong",
"quantity": 100,
"executeMode": "immediate"
}

Entry with Timed Market Exit (30 min after fill)​

{
"accountId": "your-account-id",
"strategyId": "your-strategy-id",
"sourceId": "tv-{{strategy.short_name}}-{{ticker}}-{{time}}",
"symbol": "{{ticker}}",
"action": "openLong",
"quantity": 100,
"executeMode": "immediate",
"exitTriggerType": "minutesAfterEntry",
"exitTriggerMinutes": 30,
"exitOrderType": "market"
}

Entry with Timed Limit Exit​

{
"accountId": "your-account-id",
"strategyId": "your-strategy-id",
"sourceId": "tv-{{strategy.short_name}}-{{ticker}}-{{time}}",
"symbol": "{{ticker}}",
"action": "openLong",
"quantity": 100,
"executeMode": "immediate",
"exitTriggerType": "minutesAfterEntry",
"exitTriggerMinutes": 60,
"exitOrderType": "limit",
"exitLimitPrice": 155.0
}

Limit Order​

{
"accountId": "your-account-id",
"strategyId": "your-strategy-id",
"sourceId": "tv-{{strategy.short_name}}-{{ticker}}-{{time}}",
"symbol": "{{ticker}}",
"action": "openLong",
"quantity": 50,
"executeMode": "immediate",
"orderType": "limit",
"limitPrice": {{close}}
}

Scheduled Signal (Market Open)​

{
"accountId": "your-account-id",
"strategyId": "your-strategy-id",
"sourceId": "tv-{{strategy.short_name}}-{{ticker}}-{{time}}",
"symbol": "{{ticker}}",
"action": "openLong",
"quantity": 100,
"executeMode": "scheduled",
"scheduledProcessAt": "2026-02-07T09:30:00",
"timezone": "America/New_York"
}

Troubleshooting​

Alert Not Triggering​

  • Verify the webhook URL is correct (must include /api/v1/)
  • Check that your API key has signals:write scope
  • Ensure the JSON is valid (use a JSON validator)

Order Not Executing​

  • Check the signal status in UTM Dashboard
  • Verify the account has sufficient buying power
  • Confirm market hours for the symbol

Common Errors​

ErrorCauseSolution
401 UnauthorizedInvalid API keyCheck API key is correct and has signals:write scope
400 Validation failedInvalid JSONValidate JSON format, check required fields
404 Account not foundWrong account IDVerify accountId matches your UTM account