Direct API v4: alert-sized strategy
Point TradingView at your webhook URL and send only strategy_name, {{strategy.order.action}} and {{strategy.order.contracts}}. Market, broker and risk live on the server Strategy.
Copy-ready JSON message templates for TradingView strategy and indicator webhooks — covering both TradeAdapter API v4 Saved Strategies and the MetaTrader 4/5 Expert Advisor.
In TradeAdapter API v4, broker credentials, market type, leverage, SL/TP and trailing stops are stored securely on your saved Strategy — never put broker API keys or secrets inside a TradingView alert.
Point TradingView at your webhook URL and send only strategy_name, {{strategy.order.action}} and {{strategy.order.contracts}}. Market, broker and risk live on the server Strategy.
When Strategy quantity mode is fixed or driven by an indicator, use an explicit order_action ("buy" / "sell") and include "order_price": "{{close}}" when protective rules use a reference price.
Include mt_trading_account, "platform": "metatrader", TradingView placeholders and target_type ("none", "percentage" or "pips") with lot-denominated order_contracts.
Direct API v4 strategies reference strategy_name only, keeping exchange keys encrypted inside My Brokers.
Uses standard TradingView variables: {{strategy.order.action}}, {{strategy.order.contracts}}, {{close}}, {{ticker}} and {{timenow}}.
One template works for strategy.* alerts, while paired Buy and Sell alerts drive non-strategy indicator conditions.
Every field below matches the live TradeAdapter v4 Strategy parser and MetaTrader Expert Advisor setup docs.
Reads {{strategy.order.action}} and {{strategy.order.contracts}} from TradingView. Server-side SL/TP and ladder targets apply automatically from your saved Strategy.
{
"strategy_name": "my-saved-strategy",
"order_action": "{{strategy.order.action}}",
"order_contracts": "{{strategy.order.contracts}}"
}
Omits order_contracts when your saved Strategy defines a fixed order size on the server.
{
"strategy_name": "my-saved-strategy",
"order_action": "{{strategy.order.action}}",
"order_price": "{{close}}"
}
Create two TradingView alerts on your indicator condition: one with "order_action": "buy" and one with "order_action": "sell".
{
"strategy_name": "my-saved-strategy",
"order_action": "buy",
"order_price": "{{close}}"
}
Paste into TradingView Alert Message for the MetaTrader Expert Advisor; keep order_contracts in lots.
{
"mt_trading_account": "YOUR_MT_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": "percentage",
"stop_loss": "0.01",
"take_profit": "0.02",
"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"
}