Connecting TradingView

Use your webhook URL and secret to send TradingView alerts to Ordex. Trades are then executed on your MT5 account.

Where to find your webhook URL and secret

  • Webhook Secret — Shown when you add an MT5 account, or under Webhooks in the app (copy it and keep it safe).
  • Webhook URL — Your Ordex app URL plus /api/webhooks/tv. Examples below.

Production (live app):

URL
https://ordextrader.com/api/webhooks/tv

Local testing:

URL
http://localhost:3000/api/webhooks/tv

Create an alert in TradingView

  1. Open your chart and strategy in TradingView.
  2. Right-click the chart → Add Alert.
  3. Set the Condition to your strategy or indicator (e.g. order fill, or a condition you defined).
  4. In Webhook URL, paste your webhook URL (see above).
  5. If your TradingView plan supports custom headers, add:
    • Name: X-Webhook-Secret
    • Value: your Webhook Secret
    If not, include the secret in the message (see below).
  6. In Message, use JSON. Minimum example (copy and change symbol/lots if needed):
Message (copy and edit)
{"symbol":"EURUSD","action":"buy","lots":0.01}

Add "secret":"wh_your_secret_here" if you didn't use the header. See Order types below for limit/stop orders, SL/TP, and trailing stop.

Order types: market, limit, stop, SL/TP, trailing

The webhook message supports the same fields the MT5 EA expects. Use these so you can press buy/sell in TradingView and have orders route to MT5 with the right type and levels.

  • Marketaction: "buy" or "sell", no price. Executes at current price.
  • Limit — Include "price": 1.0850. Buy limit if price < ask, sell limit if price > bid.
  • Stop — Include "price": 1.0900. Buy stop if price > ask, sell stop if price < bid.
  • Stop loss / Take profit — Add "sl" and "tp" (prices).
  • Trailing stop — Add "trailing_stop" (points). The EA may use this to trail the stop (implementation depends on your EA version).

Examples (replace symbol, lots, prices, and secret):

Market buy with SL/TP
{"symbol":"EURUSD","action":"buy","lots":0.01,"sl":1.0750,"tp":1.0950,"secret":"wh_xxx"}
Buy limit
{"symbol":"EURUSD","action":"buy","lots":0.01,"price":1.0820,"sl":1.0780,"tp":1.0900,"secret":"wh_xxx"}
Sell stop
{"symbol":"EURUSD","action":"sell","lots":0.01,"price":1.0700,"sl":1.0750,"tp":1.0620,"secret":"wh_xxx"}

A full Pine Script example (building the JSON and firing alerts) is in the repo at docs/TRADINGVIEW_PINE_ORDEX_EXAMPLE.md.

If your broker uses different symbol names

Some brokers use names like EURUSDm or GOLD instead of EURUSD or XAUUSD. In the app, go to Webhooks and add a Symbol mapping so TradingView symbols match your MT5 symbols.

Test your webhook

In the app, open Webhooks and click Test Webhook for your account. You should see a new row in Webhook Logs with success. That means Ordex received the request; the MT5 EA will execute the trade when it's connected.