Skip to main content
HomeIntegrationsWebhook → MT4
Custom webhook to MT4 integration guide

Webhook to MT4 — trade JSON signals on MetaTrader 4

To send a webhook to MT4, POST a flat JSON payload to your unique PipSync webhook URL: it validates the signal, applies your server-side risk rules, and places the order on your MetaTrader 4 account in the cloud, with no MQL4 EA and no VPS to run.

Start free — no credit cardSee pricing

Risk warning: CFDs are complex instruments with a high risk of losing money rapidly due to leverage. 70–80% of retail investor accounts lose money when trading CFDs. Risk disclosure · Past performance.

The payload is deliberately simple: an action of buy, sell or close, the broker's exact symbol name, and optional price, sl, tp, lots and comment fields. The webhook URL itself carries a secret token and acts as the credential, so any system that can make an HTTPS POST — a screener, a backtest runner, a custom bot — can drive trades on MT4 without keeping a terminal open. PipSync is the execution bridge between your code and the broker, replacing the old MQL4-EA-on-a-VPS stack with a hosted API.

Webhook to MT4 at a glance

SourceAny system that can HTTPS POST flat JSON (screeners, bots, backtests, TradingView)
DestinationMetaTrader 4 (hedging-only, MQL4 brokers)
PayloadJSON: action (buy/sell/close), symbol, optional price, sl, tp, lots, comment
CredentialUnique per-source webhook URL with a secret token; rotate from the dashboard if leaked
InfrastructureFully cloud-based — no EA, no VPS, no terminal kept open
FeedbackSigned outbound webhooks (HMAC-SHA256) + REST read API + dashboard view of every order
PriceFree plan available (EUR 0); paid plans from EUR 49/month

How do I connect a custom webhook to MT4?

Connect any HTTPS-capable system to MetaTrader 4 through PipSync in about ten minutes. You never write MQL4 or rent a VPS — PipSync hosts the execution bridge.

  1. Create a free PipSync account

    Sign up at app.pipsync.io. The Free plan is EUR 0 and needs no credit card to start.

  2. Add your MT4 account

    Connect your MetaTrader 4 broker account as a destination in the dashboard. Note that MT4 is hedging-only, so each signal opens its own position.

  3. Create a custom webhook source

    Generate a unique webhook URL for this source. The URL contains a secret token and is the credential — keep it private and rotate it from the dashboard if it ever leaks.

  4. Configure server-side risk rules

    Set fixed-lot or percent-risk sizing, SL/TP mapping, max open trades, symbol filters and optional manual approval. These run server-side before any order reaches MT4.

  5. Send a test payload in Test Mode

    POST a sample flat JSON body (action, symbol, optional price/sl/tp/lots) and use Test Mode to confirm PipSync interprets it correctly without placing a real order.

  6. Test on demo, then go live

    Point the URL at a demo MT4 account first to verify end-to-end execution, then switch to your live account when the behaviour matches your expectations.

Typical setup time: about 11 minutes.

What JSON payload does a webhook to MT4 expect?

A webhook to MT4 expects a single flat JSON object, not a nested or templated structure. The required field is action, set to buy, sell or close; close flattens the open position on that symbol. You also send symbol, which must match your broker's exact symbol name.

All other fields are optional. price is the absolute entry price, with 0 meaning a market order; sl and tp are absolute prices, with 0 meaning omit that level. lots overrides your configured sizing for that single trade — leave it out to let server-side sizing run instead. An optional comment is attached to the order for your own reference.

  • action: "buy", "sell" or "close" (close flattens the symbol's position)
  • symbol: must match the broker's exact symbol name
  • price: absolute entry, 0 = market order
  • sl / tp: absolute prices, 0 = omit
  • lots: overrides configured sizing for that trade; omit to use server-side sizing
  • comment: free-text label on the order

How does the webhook URL keep my MT4 account secure?

The webhook URL is the credential: each source gets its own unique HTTPS endpoint containing a secret token, so possession of the URL is what authorises a signal. Treat it like a password — never publish it, and send only over HTTPS.

If a URL is ever exposed, rotate it from the dashboard to invalidate the old one immediately. PipSync also applies a per-minute inbound rate limit that scales by plan, from ten per minute on the entry tier up to custom limits on Enterprise; when you exceed it the API returns 429 with a Retry-After header, so your client should back off with jitter.

Why does PipSync replace the MQL4-EA-on-a-VPS setup for MT4?

MT4 automation was historically built around an MQL4 expert advisor running inside a terminal on a rented VPS, which had to stay online to receive and act on signals. PipSync removes that entire stack: it accepts your JSON over HTTPS in the cloud and places the order on MT4 through a hosted bridge, so there is no EA to compile, no terminal to keep open, and no VPS to maintain.

Because execution lives in the cloud, signals are processed even when your own computer is off. The trade-off to know is that MT4 is hedging-only with no netting concept, so each buy or sell opens a distinct position rather than offsetting an opposite one — a key difference from MT5.

What feedback do I get after a webhook trade on MT4?

You get three layers of feedback. The dashboard shows every parsed signal and resulting order on all plans, so you can audit exactly what arrived and what PipSync did with it.

For programmatic feedback, PipSync sends signed outbound webhooks for events such as trade.opened, trade.closed, tp_hit and sl_hit, each carrying an HMAC-SHA256 signature in the X-PipSync-Signature header and retried up to five times with backoff. A REST read API (GET /v1/signals and GET /v1/trades, documented in OpenAPI 3.1) lets you poll state directly; the read API is part of the Enterprise plan.

How is webhook to MT4 different from webhook to MT5?

The JSON payload and the webhook-URL credential model are identical, so your sending code does not change between the two. The difference is in how the destination platform handles positions: MT4 is hedging-only with no netting, meaning each signal opens its own position and opposite trades coexist.

MT5 supports both netting and hedging accounts and can apply partial fills, so an opposite order may reduce or close an existing net position depending on the account type. If your strategy assumes opposite signals offset each other, that behaviour exists on MT5 netting accounts but not on MT4, where you typically use a close action to flatten.

Try it on the free plan

Connect a signal source and a broker account, watch PipSync parse and route in real time, and upgrade only if you need more. No credit card required to start.

Start free — no credit cardSee pricing

Risk warning: CFDs are complex instruments with a high risk of losing money rapidly due to leverage. 70–80% of retail investor accounts lose money when trading CFDs. Risk disclosure · Past performance.

FAQ

Frequently asked questions

What is the minimum JSON needed to open a trade on MT4?

At minimum you send action and symbol, for example {"action":"buy","symbol":"EURUSD"}. With no price it executes at market, and with no lots it uses your configured server-side sizing. Optional sl, tp and comment fields refine the order.

Written by the PipSync team · Reviewed by Tobias Russmann, Director, PipSync · Published · Last updated

PipSync is a cloud-based signal automation platform that routes trading signals from Telegram, Discord, TradingView alerts and custom webhooks to broker accounts on MetaTrader 4, MetaTrader 5, cTrader, Match-Trader, Binance Futures and Bybit — with server-side risk management and no VPS required. PipSync is an execution tool, not a signal provider and not investment advice.

PipSync is a signal execution tool. It does not provide trading signals, does not guarantee any trading results and is not investment advice. Trading leveraged products involves substantial risk of loss. See the full risk disclosure and performance disclaimer.