If you use TradingView for charting and analysis, you can now automate your alerts directly to MT4 or MT5 through TradeJournal. When your Pine Script strategy generates a signal, TradeJournal receives it and executes the trade on your broker — no manual copying required.
How the Webhook Works
- TradingView triggers an alert (from a Pine Script condition or indicator)
- TradingView sends a POST request to your TradeJournal webhook URL
- TradeJournal parses the signal and queues it for execution
- Your MT4/MT5 EA picks up the signal and opens the trade
The webhook removes the manual copy-paste step, but end-to-end timing varies with TradingView delivery, the execution path, network, provider, broker, and market.
Prerequisites
- A TradeJournal Pro plan (TradingView and other webhook sources are Pro features)
- A paid TradingView plan (webhook alerts aren't available on TradingView's free plan)
- MT4 or MT5 EA installed and connected (see Signal Copier setup guide)
Step 1 — Get Your Webhook URL
- In TradeJournal, open TradingView Webhook in the sidebar
- Copy your unique webhook URL — it looks like:
https://tradejournalpro.net/api/signals/webhook?token=YOUR_TOKEN - Keep this URL private — anyone who has it can send signals to your account
Step 2 — Create a TradingView Alert
In TradingView, open your chart and click the Alert button (clock icon) or press Alt+A.
In the alert dialog:
- Condition: Select your Pine Script indicator or strategy
- Action: Check Webhook URL
- Webhook URL: Paste your TradeJournal webhook URL
- Message: This is where the signal data goes (see below)
Step 3 — Format the Signal Message
The webhook message must include the signal details. TradeJournal accepts JSON or plain text:
JSON Format (Recommended)
{
"pair": "XAUUSD",
"direction": "LONG",
"entry": {{close}},
"sl": {{plot("Stop Loss")}},
"tp1": {{plot("Take Profit 1")}},
"tp2": {{plot("Take Profit 2")}}
}
TradingView replaces {{close}}, {{plot(...)}} etc. with the actual values when the alert fires.
Plain Text Format
XAUUSD BUY
Entry: {{close}}
SL: {{plot("SL")}}
TP1: {{plot("TP1")}}
TP2: {{plot("TP2")}}
Both formats work. JSON is more reliable for automated parsing.
Step 4 — Pine Script Example
Here's a simple Pine Script strategy that sends signals to TradeJournal:
//@version=5
strategy("TradeJournal Webhook Example", overlay=true)
// Simple MA crossover
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)
longCondition = ta.crossover(fast, slow)
shortCondition = ta.crossunder(fast, slow)
atr = ta.atr(14)
slDistance = atr * 1.5
tpDistance = atr * 3.0
// Build the webhook message in Pine, so the stop and target travel with the order
msg(dir, sl, tp) =>
'{"pair":"' + syminfo.ticker + '","direction":"' + dir + '","entry":' + str.tostring(close) +
',"sl":' + str.tostring(sl) + ',"tp1":' + str.tostring(tp) + '}'
if longCondition
longSl = close - slDistance
longTp = close + tpDistance
strategy.entry("Long", strategy.long, alert_message = msg("BUY", longSl, longTp))
strategy.exit("Long Exit", "Long", stop = longSl, limit = longTp)
if shortCondition
shortSl = close + slDistance
shortTp = close - tpDistance
strategy.entry("Short", strategy.short, alert_message = msg("SELL", shortSl, shortTp))
strategy.exit("Short Exit", "Short", stop = shortSl, limit = shortTp)
When you create the alert on this strategy, put only this in the alert's Message box:
{{strategy.order.alert_message}}
TradingView replaces it with the JSON built above for each order. Placeholders can only insert values; they can't calculate, so an expression such as {{close - 10}} won't work. Do the maths in Pine, as here.
Note that the exit orders also fire alerts. Their message is empty unless you give strategy.exit its own alert_message, and an empty message is rejected without opening a trade.
Step 5 — Test the Connection
- In TradingView, manually trigger your alert by right-clicking on the chart → Add Alert → set condition to "Once" and save
- Check TradeJournal → Signal Copier → Signals — you should see the signal appear within seconds
- Verify the parsed values (pair, direction, entry, SL, TP) look correct
- If auto-execute is ON for webhook signals, check your MT4/MT5 for the trade
Configuring Webhook Signal Settings
In TradeJournal → Signal Copier → Webhook Settings, you can configure:
- Auto-execute: Execute immediately or hold for manual approval
- Default lot size: Used when no lot is specified in the webhook payload
- Target account: Which EA account(s) receive webhook signals
- Require confirmation: Get a notification before execution
Supported Signal Fields
| Field | Required | Description |
|---|---|---|
pair | Yes | Trading pair (XAUUSD, EURUSD, etc.). symbol and ticker also work |
direction | Yes | BUY or SELL (also LONG/SHORT, any case). action and side also work |
entry | No | Entry price (uses market price if omitted) |
sl | No | Stop loss price |
tp1 | No | Take profit 1 |
tp2 through tp5 | No | Additional take profit levels |
lot | No | Lot size (overrides account default) |
order_type | No | BUY_LIMIT, SELL_LIMIT, BUY_STOP or SELL_STOP for a pending order at entry; market if omitted |
Advanced: Multiple Symbols from One Strategy
If your strategy trades multiple symbols, include the symbol dynamically:
{
"pair": "{{ticker}}",
"direction": "{{strategy.order.action}}",
"entry": {{close}}
}
TradingView replaces {{ticker}} with the chart's symbol and {{strategy.order.action}} with buy or sell, which the webhook accepts.
Troubleshooting
Alert fires but no signal in TradeJournal
- Verify the webhook URL is correct (no extra spaces or line breaks)
- Check TradingView's alert history for delivery status
- Make sure the message body is valid JSON if using JSON format
Signal appears but wrong values
- Check that your Pine Script plots are named correctly
- Test with a simple fixed-value message first to confirm connectivity
Trade executes at wrong price
- Webhook signals are market orders by default
- Add
"order_type": "BUY_LIMIT"(orSELL_LIMIT) and anentryprice to the payload for a pending order
Keep the URL private
The token in your webhook URL is what lets an alert reach your account, so treat the URL like a password: don't paste it in screenshots, shared scripts or public chats.
Common use cases
- Run a Pine Script strategy live, hands-free
- Send a manual chart alert straight to MetaTrader
- Combine TradingView entries with prop-firm risk limits
Combining Webhooks With Telegram
You can run both simultaneously. Some traders use:
- TradingView webhook for their own automated strategy
- Telegram copier for third-party signal channels
Both feed into the same Signals queue, same EA. You get everything in one place.