GUIDE · WEBHOOKS · OCTOBER 2026

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.

BBenjamin SF · Founder Published Oct 31, 2026 Read 9 min

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.

01

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.

02

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.

03

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.

Goal
What actually exists
Where to go
Execute my alerts automatically
Alert webhook + bridge + EA. Official, reliable, real orders.
This guide. The path most people want.
Pull live prices into my code
No official retail feed. Unofficial scrapers, or your broker's own API.
Not a TradingView product. Use broker data.
Embed charts on my site
Official widgets and the licensed charting library.
TradingView's own widget docs.
Run strategies without watching charts
Pine Script + webhook export, executed by an automation platform.
The bridge guide compares them.

The webhook path: alert to order in three hops

WHAT HAPPENS BETWEEN YOUR PINE CONDITION AND THE BROKER.

1

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

2

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)

3

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.

ALERT MESSAGEJSON
{"action":"buy","symbol":"EURUSD","lot":0.01,"sl":50,"tp":100}
sl / tp

Distances 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.

symbol

Broker suffixes like EURUSD.m are handled per account - or alias them once in the dashboard. Details in the formats guide.

415 / 400 errors

The 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.

TG

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.

SUBMIT A SIGNALPOST + BEARER KEY
{"symbol":"EURUSD","action":"buy","lot":0.01,"dry_run":true}
API keys

Created 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 server

The 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.

Docs

Full 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?+
No. TradingView does not publish a public trading API for retail traders. The supported automation path is the alert webhook, which any paid plan can send to an external bridge.
Do I need a paid TradingView plan?+
For webhook alerts, yes - that is a TradingView requirement, not the bridge. If your signals live in a Telegram channel, SFCopier executes them without any TradingView subscription.
Does it work with MT4 and MT5?+
Yes. The same webhook message executes in MetaTrader 4 and MetaTrader 5, including prop-firm accounts with symbol suffixes and custom symbol names.
Can Python connect to TradingView?+
Not officially. Unofficial scrapers break often and may violate the terms of service. The reliable pattern is Pine Script sending a webhook, plus the bridge REST API when your code needs to submit or query signals itself.
How much does automation cost?+
SignalForge starts at $4.99/mo with a 14-day free trial. The TradingView plan is separate and sold by TradingView.

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

Paste any payload in the free webhook tester and see what would execute · no accountOpen tester →