TradingView API: how to automate alerts into MT5
TradingView does not publish a trading API for retail traders - and that surprises everyone who searches for one. What it does publish is an alert webhook, and with the right bridge that webhook behaves exactly like the API you were looking for: your Pine condition fires, a JSON message leaves TradingView, and a real order lands in your MT4/MT5 account. This guide shows the whole path, the message format, and what to do when things fail.
Quick answer
SIXTY WORDS, NO SCROLLING.
Quick answer: TradingView has no official public trading API for retail traders. The supported automation path is the alert webhook: TradingView POSTs a JSON message when your condition fires, and a bridge translates it into an MT4/MT5 order. SignalForge runs that path end to end - hosted, no PC left on - from $4.99/mo, with retries and an acknowledgment per signal. Checked October 31, 2026.
Does TradingView have an API?
THE HONEST ANSWER, IN THREE PARTS.
What TradingView actually publishes
Three things, none of them a trading API you can call: the charting library and broker integrations (for institutions licensing the platform), Pine Script (automation that runs inside TradingView), and alert webhooks (paid plans): your alert can POST a message to any URL you own. That webhook is the only official door from a TradingView condition to the outside world - which makes it, functionally, the TradingView API.
What the unofficial clients are
Search "TradingView API" and you will find GitHub wrappers that scrape the web app or replay its private endpoints. They work until TradingView changes something, they can violate the terms of service, and they have no support. Fine for a weekend data project; dangerous when real money rides on the connection. For trading, use the supported door: the webhook.
Why this keeps confusing people
TradingView the company has APIs - for brokers, for the charting library, for market data partnerships. Retail traders read "API" in a changelog, assume there is a REST endpoint for orders, and land on forum threads asking why nobody answers. There is no such endpoint. The next section maps what people actually want when they type this query - and which of those things a webhook bridge covers.
Four things people mean by "TradingView API"
MATCH YOUR GOAL TO THE REAL MECHANISM.
The webhook path: alert to order in three hops
WHAT HAPPENS BETWEEN YOUR PINE CONDITION AND THE BROKER.
The alert fires
An indicator cross, a Pine alert(), or a manual level. The alert's Message box holds your JSON payload; the Notifications tab holds the webhook URL. Requires a paid TradingView plan
TradingView POSTs your URL
One HTTPS POST per alert, with the JSON you wrote. The URL identifies your account - no keys inside TradingView, nothing to leak from a shared chart. Retry policy owned by TradingView (5xx only)
The bridge executes in MT4/MT5
The bridge validates the payload, applies your account's sizing and symbol aliases, and the EA places the order - SL and TP included in the same message, acknowledged back to the dashboard. Full path in the setup guide
Writing the alert itself: the Pine Script alert guide covers alert() vs alert_message, placeholders and one-alert-per-chart setups. Payload examples below.
The JSON message your alert sends
TWELVE FIELDS COVER ALMOST EVERY STRATEGY.
{"action":"buy","symbol":"EURUSD","lot":0.01,"sl":50,"tp":100}
sl / tpDistances from entry by default, or absolute prices with sl_price. Partial takes, closes by side and close-all exist for exits.
{{plot("Stop Loss")}}Pine placeholders inject live values - but if the plot name does not match exactly, TradingView shows an orange icon and sends the literal text. The 15-payload reference shows the safe patterns.
symbolBroker suffixes like EURUSD.m are handled per account - or alias them once in the dashboard. Details in the formats guide.
415 / 400 errorsThe two failures everyone hits first, decoded with fixes in the error 415 guide.
Before touching a live account, paste any payload into the free webhook tester: it shows exactly what would execute, in your browser, no account needed.
What happens between the alert and the order
THE PART MOST COMPARISONS SKIP.
- Nothing runs on your PC. The webhook lands on the bridge; execution happens on your MT4/MT5 terminal - yours, or a hosted terminal (SFCloud) if you do not want a VPS. Close the laptop; alerts keep executing.
- Every signal is acknowledged. The EA confirms execution back, and the dashboard shows the receipt - or the exact rejection reason with the original payload, so a failed filter is a five-second diagnosis instead of a mystery.
- Offline queues instead of drops. If your terminal disconnects, signals queue and retry when it returns. Some bridges reject while you are offline and the alert is simply gone - TradingView only retries server errors, so the bridge owns this part of the promise.
- Sizing and filters stay per account. Fixed lot, risk-percent sizing, symbol aliases, trend and news filters - all configured once per MT5 account, not per alert.
No paid TradingView plan? The Telegram alternative
SIGNALS DO NOT HAVE TO COME FROM TRADINGVIEW.
SFCopier: channels to orders
If your signals already live in a Telegram channel - yours or one you follow - SFCopier reads the channel and executes in MT5 with the same bridge underneath: same sizing, same acknowledgment, no TradingView subscription at all. Included from the Starter plan. For many prop-firm traders this is the cheaper entry: the channel is the strategy, SFCopier is the hands.
For developers: REST API and MCP
WHEN YOUR CODE - OR YOUR AI AGENT - IS THE STRATEGY.
{"symbol":"EURUSD","action":"buy","lot":0.01,"dry_run":true}
API keysCreated in the dashboard, scoped, revocable instantly. Submit signals, poll status, read execution receipts from your own code. Dry-run is the default, so testing never touches the account.
MCP serverThe same capabilities exposed as an MCP server for AI clients: an agent can check positions, submit a signal and read the acknowledgment, with the same scopes as a key. Included from the Trader plan.
DocsFull reference, auth and examples live at api.signalforge-ai.com/docs/api - public, no login. Product overview: SFConnect.
FAQ
THE FIVE QUESTIONS THIS GUIDE GETS.
Is there an official TradingView API?+
Do I need a paid TradingView plan?+
Does it work with MT4 and MT5?+
Can Python connect to TradingView?+
How much does automation cost?+
SEE IT EXECUTE BEFORE YOU PAY
Test any payload free, or check the plan that fits your setup.
14-DAY FREE TRIAL · NO CARD · MT4 & MT5