TradingView alerts for MetaTrader
Configure your TradingView alert (message + webhook or email) so TradeAdapter forwards orders to your MT4 or MT5 Expert Advisor.
Before you start #
You should already have the TradeAdapter EA installed on an MT4 or MT5 chart and your API key entered. If not, complete MT4 Setup or MT5 Setup first. Then: use a Forex (or CFD) symbol on TradingView that your broker supports in MetaTrader, and add your strategy or indicator to the chart. Not sure which you have? See Indicator vs Strategy.
Create the alert #
-
Condition
Strategy: Under Condition, select your strategy and choose “Order fills only”. TradingView will fill action, size, and price via placeholders. Indicator: Select the specific condition (e.g. Buy, Sell) for each alert — you will set order_action and order_contracts manually in the message.
-
Notifications
In the Notifications tab: enable Webhook URL and paste your personal webhook from your TradeAdapter Profile. If your TradingView plan does not support webhooks, use “Send plain text” (Email) and use the email address from your profile.
Message format (MetaTrader) #
Required fields in the alert message:
| Field | Description |
|---|---|
mt_trading_account |
Your MT4/MT5 account number |
platform |
"metatrader" |
time |
e.g. {{timenow}} |
ticker |
e.g. {{ticker}} or symbol name |
order_type |
e.g. "Market" |
order_contracts |
Size in LOTS (see note below) |
order_action |
"buy" or "sell"; Strategy: {{strategy.order.action}} |
order_price |
Strategy: {{strategy.order.price}} |
target_type |
"none", "percentage", or "pips" |
stop_loss, take_profit |
Values according to target_type |
market_position, prev_market_position |
Strategy: {{strategy.market_position}}, {{strategy.prev_market_position}} |
market_position_size, prev_market_position_size |
Strategy: use strategy placeholders |
strategy_number |
e.g. "1" |
Strategy: use placeholders like {{strategy.order.action}}, {{strategy.order.contracts}}, {{strategy.order.price}}. Indicator: set order_action and order_contracts manually in each alert message.
Order size in LOTS
order_contracts must be in LOTS for Forex. Check lot size and step for your symbol in MetaTrader.
Recreate alert after strategy changes
If you change parameters of your Pine Script strategy, delete the alert and create it again.
Strategy vs Indicator #
One alert; TradingView fills action, contracts, price and market position via placeholders. Message Generator (Strategy)
One alert per action. Set order_action and order_contracts manually. Message Generator (Indicator)
Monitor execution — Your trades in MT #
When an alert fires, TradeAdapter receives it and sends the order to the EA on your MT4/MT5. The trade then appears in your MetaTrader terminal (Trade/Positions) and in your account. To verify each signal was received and executed, check the MyTrades page (MetaTrader).