TradingView to MetaTrader webhook setup for MT4 and MT5

Complete tradingview to mt4 and tradingview to mt5 alert setup with tradingview webhook automation, structured JSON, and automate tradingview alerts through TradeAdapter.

Step 1

Use forex symbols on TradingView

Choose the forex symbol you want to route to MetaTrader 4 or MetaTrader 5.

Step 2

Add your Pine strategy to the chart

Open Pine Editor, add or paste your strategy, then press Add to chart.

Strategy on chart
TradingView strategy on chart
Step 3

Create a TradingView strategy alert

Verify backtest results in Strategy Tester, then create an alert for buy/sell events.

Create alert
Create TradingView alert
Step 4

Set alert message and webhook URL

Paste JSON from the template below or use the Message Generator. Add your TradeAdapter webhook URL from your profile page.

Message tab
TradingView alert message
Notifications
TradingView webhook notification
Step 5

Monitor signals on MetaTrader MyTrades

If orders do not appear in MT4/MT5, check the MetaTrader MyTrades page for execution status.

JSON

TradingView alert message template

What the Expert Advisor does and how the pieces fit together: TradingView to MT5 and MT4 automation.

{
  "mt_trading_account": "Put here your MT4/5 Trading Account Number",
  "platform": "metatrader",
  "time": "{{timenow}}",
  "ticker": "{{ticker}}",
  "order_type": "Market",
  "order_contracts": "{{strategy.order.contracts}}",
  "order_action": "{{strategy.order.action}}",
  "order_price": "{{strategy.order.price}}",
  "target_type": "none/percentage/pips",
  "stop_loss": "Put SL value like 0.1 / 0.01 / 0.002",
  "take_profit": "Put TP value like 0.1 / 0.01 / 0.002",
  "market_position": "{{strategy.market_position}}",
  "market_position_size": "{{strategy.market_position_size}}",
  "prev_market_position": "{{strategy.prev_market_position}}",
  "prev_market_position_size": "{{strategy.prev_market_position_size}}",
  "strategy_number": "1"
}

Note: order_contracts must be in lots. Recreate the alert whenever you change Pine strategy parameters.