Five Numbers That Decide If a Gold EA Survives Its Broker
Spread, commission, swap, slippage and rollover widening all come out of the same 100-ounce contract. A worked cost model for gold EAs, and a thirty-day audit you can run on your own fills.
Most gold EAs are tested against the chart. Very few are tested against the invoice. If you are sizing a test by hand rather than by EA, the desk's position-size calculator does the same arithmetic in the browser, and the rest of the EA library works through the engineering this article assumes. That is the gap where accounts quietly die: a strategy with a genuine edge on the price series can still lose money once spread, commission, swap and slippage are subtracted from every trade it takes.
Gold makes this worse than almost any other instrument on a retail platform. A standard XAUUSD lot is 100 troy ounces — the contract specification most platforms use — so a $1.00 move in the metal is $100 per lot. Costs that look like rounding errors on EURUSD — a 30-cent spread, a $7 commission — are $30 and $7 of the same $100. The cost stack is not a detail of the strategy. For a high-frequency system it is the strategy.
These are the five numbers worth auditing before you blame the logic.
1. Spread: the advertised number is not the traded one
Brokers quote gold spreads "from" a figure that appears during the London session on a quiet Tuesday. What your EA pays is the spread at the moment its order arrives, which is a different distribution: wider at the Asian open, wider at the New York close, violently wider for 90 seconds around a CPI print.
The right measure is the median and the 90th percentile spread over the hours your EA actually trades, not the headline. If your system trades a fixed session, measure that session only — a 12-cent median at 14:00 UTC is irrelevant to an EA that fires at 23:30.
In MT5 the live spread is available in points: SymbolInfoInteger(_Symbol, SYMBOL_SPREAD) returns the spread in points, and multiplying by SymbolInfoDouble(_Symbol, SYMBOL_POINT) gives the price distance — the MQL5 reference documents both. Log it on every tick for thirty days and you will discover which broker you actually have, as opposed to the one in the marketing table.
2. Commission: the spread markup hiding behind a tight quote
There are two ways to charge for the same liquidity. Either the spread is wider and there is no commission, or the spread is tight and you pay a per-lot commission. A "raw" account at 10 cents spread with $7 round-turn commission costs more per lot than a standard account at 30 cents and nothing, because 20 cents of spread equals $20 on 100 ounces — nearly three times the commission.
Compare the two as one number: spread in dollars plus commission in dollars, per round turn, per lot. Anything that quotes only one half of that pair is quoting the flattering half.
3. Swap: the cost that scales with how long you hold
Overnight financing is charged on both sides, and for gold the long side usually pays. Two facts matter more than the rate itself:
- The charge is nightly, so an EA that holds through the close accumulates it every day it stays in the market.
- Wednesday is a triple charge on most platforms, because the value date rolls over the weekend under T+2 settlement — the mechanic is explained here and the rate structure is tabulated here.
For an intraday EA this line is zero. For a swing system holding three nights a week it can be the largest single cost, and it is the one that never appears in a backtest unless the tick data carries real swap rates. If your EA holds positions overnight, the carry budget belongs in the strategy, not in the hope that the trade moves first.
4. Slippage: what your stop actually costs
Slippage is the difference between the price your EA asked for and the price it got. There are three places it shows up and only one of them is visible:
- Market entries during thin hours — a few cents.
- Stop-loss fills during a fast move — the expensive one. A stop is a market order once triggered; in a news spike the fill can be dollars away from the level.
- Rejected or requoted orders — a trade that never happens is not free if the logic counted on it.
Measure it the same way you measure spread: log the requested price and the executed price for every fill, then report the mean and the worst case in dollars per lot. MT5 exposes the executed price on the deal (DEAL_PRICE) through the history functions, so a fill-by-fill audit is a hundred lines of MQL5, not a research project.
A stop placed 20 dollars from entry on an instrument that ranges 70 dollars a day is not a stop with 20 dollars of slippage protection. Widen the invalidation and cut the size instead; the risk in dollars stays the same and the fill quality improves.
5. Rollover widening: the daily trap
Around the daily rollover the book thins and spreads widen for a few minutes. An EA with no spread filter will happily take a signal in that window and pay two or three times its normal cost. The fix is one line: a maximum-spread gate that blocks entries above, say, the 90th percentile of the measured distribution. This is the cheapest improvement most EAs can make, and it costs nothing in expected profit because the trades it removes were the ones paying the most to enter. Set the threshold from your own data: if the 90th percentile of measured spread is 45 cents, a 45-cent gate removes the worst decile without touching normal conditions. Anything tighter starts refusing the trades your edge depends on, so measure first and hard-code second.
The model: what all of it adds up to
Take an EA doing 20 round turns a week — roughly 1,000 a year — on one standard lot. Assume a 25-cent spread, $7 commission and, on a third of those trades, a dollar of slippage. That is $25 + $7 + $0.33 in expectation, about $32 per round turn, or $32,000 a year in costs. The strategy has to clear that before it earns anything: on a $10,000 account, the cost stack alone is three times the account.
That arithmetic is why the threshold matters. If all-in cost per trade exceeds 15–20% of the average winning trade, the system cannot compound — not because the entries are wrong, but because the toll is too high. Run the number before optimising the indicator.
A thirty-day audit you can run this week
- Log spread every minute, tagged by hour, for a month.
- Log requested versus filled price on every order.
- Pull the swap rates your account actually charged, long and short, and note the triple-swap day on your server.
- Convert all four into dollars per lot per round turn.
- Compare that total against your average win. If the ratio is above 20%, fix the broker or the holding period before touching the strategy.
Nothing in that list requires an opinion about which broker is better. It requires your own fills. If you want the execution side of the problem in more depth, the execution topic hub collects the related pieces.
Sources: MQL5 SymbolInfoInteger reference · XAUUSD contract specification · triple-swap Wednesday mechanics · XAUUSD swap rate table · which side pays swap on gold
Broker costs change without notice, and the figures above are a model to be replaced with your account's own statements, not a claim about any specific provider. Automated trading carries the risk of losing more than your deposit; past cost data is not a forecast of future execution.