← All articles

Market structure

Broker, liquidity provider, prime broker: who actually fills your trade

The retail broker is only the first link. Here is the full chain behind a forex or gold order, and why an EA developer should care.

Published 21 October 2026By PGFX7 min read

When you press Buy on XAUUSD in MetaTrader 5, the trade looks instant and simple. Behind it there are usually three or four separate businesses, each with its own job and its own way of earning. Knowing who they are explains most of the things that surprise traders: spreads that jump at 23:59 server time, slippage on news, requotes, and why the same robot behaves differently with two brokers.

1. The retail broker

The retail broker is the company that opens your account, holds your deposit (or arranges for a bank to hold it), runs the MT5 server and sets your account rules: leverage, margin call and stop-out levels, minimum lot, swap and commission. It is the only party you have a contract with.

The broker also runs a risk desk, which decides what happens to each order. That decision is the single biggest factor in how your trades are filled.

2. A-book, B-book and hybrid

ModelWhat happens to your orderHow the broker earns
A-bookPassed on to outside liquidity, usually through a prime broker or prime of primeSpread mark-up and/or commission
B-bookKept in-house; the broker is the other side of your tradeSpread, plus your net trading losses
HybridRisk desk routes some flow out and keeps some, often by account, size or trader profileMix of both

B-booking is not automatically dishonest; many regulated brokers do it and hedge their net exposure. What matters for you is that the execution behaviour differs. Internalised orders can fill very fast at the quoted price. Orders passed outside depend on what external liquidity is available at that moment.

3. Liquidity providers

Liquidity providers (LPs) are the firms that stream two-way prices and are willing to trade on them: large banks, and non-bank market makers that run their own pricing engines. Each LP sends a stream of bids and offers with a size available at each level. An LP can reject or "last look" an order if the price has moved by the time it arrives.

For gold, LPs price XAUUSD spot as a CFD or as spot metal. When volatility rises, many LPs widen their quotes or reduce the size they show at once. That is why gold spreads widen sharply around US data and the daily rollover.

4. The prime broker

A retail broker usually cannot open trading relationships with many top-tier banks on its own; each one needs credit lines, legal agreements and collateral. A prime broker solves this. It gives the broker credit and lets it trade with many LPs through one account, in the prime broker's name. The prime broker then settles all those trades centrally.

5. Prime of prime

Tier-one prime brokers have high minimums, so most small and mid-sized brokers connect through a prime of prime (PoP). A PoP holds a relationship with a major prime broker and re-offers that access, often together with its own aggregated liquidity pool and a bridge to MT5, to smaller brokers.

6. The technology in between

  • Aggregator: merges quotes from several LPs into one order book, so the broker can show the best bid and best offer across all of them.
  • Bridge: connects the MT5 server to the aggregator or LP, translating MT5 orders into the institutional protocol (commonly FIX) and sending fills back.
  • Mark-up: the broker adds its margin on top of the raw spread at the bridge or server level.

7. Why this matters for your EA

  • Spread assumptions: a scalper that works on a 12-point fixed tester spread can fail on a raw-plus-commission account at rollover. Test with real-tick spreads and a stressed spread.
  • Slippage on stops: on an A-book route, a stop-loss becomes a market order when triggered and fills at whatever liquidity remains. Build risk on the assumption that stops can slip on news.
  • Order frequency: very high-frequency strategies can be flagged or re-routed by risk desks. Know your broker's execution policy.
  • Broker choice is part of the strategy: forward-test on the exact broker and account type you will trade live.

Key point: your backtest assumes a perfect counterparty. The real counterparty is a chain of firms, each with its own rules. A robust EA is tested for the execution it will actually get, not the execution the tester assumes.

← More articles Ask on Telegram →