Docs / Trading and risk

Trade routing and the MT5 trade gateway

Route client trades A-book, B-book or hybrid: let an LP take orders, connect MT5 through the XiroLink Trade Gateway, choose how trades fill, and set the safety controls.

XiroLink routes client trades as well as prices. Each trade is decided by the bridge in milliseconds: filled in house (B-book), passed to a liquidity provider (A-book), or filled at once and covered at the LP afterwards. You choose per platform.

text
MT5 ──► XiroLink Trade Gateway ──┐
                                 ├──► XiroLink bridge ──► LP (FIX 4.4)
Dealing desk ────────────────────┘          │
                                            └──► risk account (the book)

Trades reach the bridge from two places today:

  • MetaTrader 5, through the XiroLink Trade Gateway, for the groups you choose in MT5 Administrator.
  • The dealing desk, for your own orders on a risk account.

More platforms can be added on request.

1. Let an LP take orders

A-book routing and cover need a FIX 4.4 maker that accepts orders. Skip this step if you only fill in house.

In your bridge, go to Makers, edit the FIX maker and open Trading.

Field What to enter
Send orders to this LP On. Prices are not affected.
Order session One session for prices and orders uses the price login. Separate order session is for LPs that give a second login only for orders: enter its Order host, Order CompIDs and Order password.
Use TLS On when the LP asks for an encrypted connection. The bridge encrypts it itself.
Check the LP's certificate Leave on. Turn off only for an LP with a self-signed certificate.
Keep sequence numbers across logins Leave on unless the LP asks for a reset at each login.
Account at the LP (if required) FIX tag 1. Leave blank unless the LP gave you one.
Order type Market fills at the LP's price. Limit uses the LP's current price plus the Slippage you allow, never worse.
Time in force Immediate or cancel fills what it can now and cancels the rest. Fill or kill fills in full or not at all.

The maker then shows Order session with its status. Orders are sent only while it is logged on.

2. Set up the trade gateway for an MT5 server

Go to Takers and open the MT5 taker for that server. A new MT5 taker can get its feeder and trade gateway together when you create it. For an existing one, choose Set up trade gateway under Trade gateway.

The bridge shows:

Detail Notes
Server address Your bridge's address and the gateway port.
Login Generated for you, and says what it is for. You can change it.
Password Shown once. Copy it now; New password makes another and disconnects the gateway until MT5 has it.

One MT5 server, two connections: the feeder takes prices on the taker port, the trade gateway sends client trades on the gateway port. Removing the gateway does not affect the feeder.

3. Connect it in MT5 Administrator

We supply the XiroLink Trade Gateway and install it with you. In MT5 Administrator:

  1. Add the XiroLink Trade Gateway with the server address, login and password from step 2. Set TLS to 0 for now.
  2. Choose the groups whose trades should go through it. Groups you leave out keep your current execution.
  3. Enable the gateway. In the bridge, Trade gateway turns to Connected from the server's IP and version.

4. Choose how trades are filled

In the taker's Trade gateway settings:

Execution What happens
Fill at client's price Every trade is filled at once at the price the client asked, then covered at the LP in Cover at. If the LP refuses or fills only part, the client keeps the trade and a critical alert is raised. Choose No cover (in house) to keep these trades. This is the default.
LP first A-book. The trade goes to the LP you choose in LP first, and the client is filled with the LP's result. Needs an LP from step 1.
Bridge price (B-book) Filled in house at the price this taker sees, with no LP. Hold before filling (ms) waits that long, then fills at the price at that moment.

Other settings:

Setting What it does
Book client deals on A risk account where routed trades are booked, so positions, P&L and exposure stay current. Or leave them unbooked.
Net copy-trade bursts When trades go to an LP: trades for the same symbol and side within the Netting window (ms) go as one order. Each client still gets their own fill and price. Default 20 ms.
Answer timeout (ms) How long MT5 waits for the bridge's answer, from 500 to 30,000 ms. It must be longer than the netting window or hold. Saving a new value reconnects the gateway once.

5. Safety controls

Control Where What it does
Price collar (%) Trade gateway With Fill at client's price, a client price further than this from the market is not used. When it trips: Fill at bridge price, or Reject. Default 0.1%; 0 turns it off.
Max lots per trade Trade gateway Larger trades are rejected. 0 means no limit.
Halt trading Dealing desk Stops all trading at once, with a reason the team sees. Gateway trades are rejected, except stop-outs, which close in house at the market with no LP cover. No orders go to LPs, desk routing included. Book only still works on the desk. Resume trading turns it back on.

Halting and resuming are recorded in the audit log and sent as alerts.

6. Route desk orders to an LP

On the Dealing desk, choose an account and, under Send to, an LP that takes orders. Orders go to the LP first, then fill the account at the LP's price. Book only fills the account without an LP order.

Take profit and stop loss stay on the desk and are not sent to LPs. Closing a routed position sends an opposite order to the LP, and the position closes as it fills. The LP orders table lists every order sent from the account, with its status.

7. Watch it run

  • Recent trade requests on the trade gateway lists each request with its result (done, partial, rejected or requote), price and reason.
  • An alert is raised when an LP order session stays down for over 30 seconds, and again when it recovers.
  • An order the LP has not answered for 60 seconds raises an alert. The bridge asks the LP for its status at each logon and every 15 seconds until it is settled.
  • Refused covers are grouped into one alert per symbol and side every few seconds, so a burst never floods your channels.
  • When the bridge restarts, every trade record and confirmation still waiting is saved first.

See Alerts and webhooks to choose where alerts go.

Something unclear or out of date? Email [email protected].