Blog

Building an EA for Gold (XAUUSD): What Is Different

TradeSmithy Team4 min read

Short answer: an EA built for EURUSD usually misbehaves on gold because gold's contract size, point size, spread and daily range are all different — and differ between brokers. A gold EA should read the symbol's contract size, tick value, point and minimum stop distance at runtime, size positions from account balance and stop distance, and set stops in proportion to volatility rather than fixed pips.

What makes XAUUSD different?

PropertyTypical EURUSDTypical XAUUSDWhy it matters
Contract size100,000 units100 troy ouncesProfit per price move is completely different
Point size0.000010.01 or 0.001, by broker"300 points" is not the same distance everywhere
SpreadFractions of a pipMuch wider in price termsScalping is harder; spread filters matter
Daily rangeTens of pipsMany dollarsFixed stops sized for forex are hit by noise
Minimum stop distanceSmallOften largerTight stops get invalid stops errors

"Typical" is doing a lot of work: check your broker's contract specification (right-click the symbol in Market Watch → Specification). Some brokers quote gold as GOLD, XAUUSDm or XAUUSD.pro, with different contract sizes.

How much is gold's lot worth?

On a 100-ounce contract, a $1 move in the gold price is worth $100 per standard lot, or $1 per 0.01 lot. So on a $1,000 account risking 1% ($10) with a stop $10 away from entry, the position is 0.01 lots. The same stop on a 1-lot position would risk the entire account.

This is exactly why lot sizes copied from forex strategies blow up gold accounts. Size every trade from balance, risk percentage and stop distance — the method, step by step.

Stops that fit gold's volatility

A 20-pip stop that is sensible on EURUSD is inside gold's normal noise. Two approaches work better:

  • ATR-based stops — a multiple of the Average True Range, so the stop widens when gold is volatile and tightens when it is quiet.
  • Structure-based stops — beyond the previous candle's high or low.

Either way, check the result against the symbol's minimum stop distance before sending the order.

Spread and timing

Gold's spread widens sharply around US data releases and at the daily rollover. A gold EA should:

  • Skip entries when the spread is above a threshold.
  • Avoid entering in the minutes around rollover, when spreads are widest.
  • Be tested with realistic spread — ideally real ticks, which carry the actual spikes. Every tick vs real ticks.

Building a gold EA in TradeSmithy

The values a gold EA needs are all readable in the graph through the Symbol Info node, straight from the broker at runtime rather than typed in:

  • Contract size, Tick value and Tick size — to turn a stop distance into money for position sizing.
  • Min stop distance (points) — to keep stops legal.
  • Spread (points) — for a spread filter.
  • Minimum lot, Maximum lot and Lot step — to round lots to what the broker accepts.

Combine them with an ATR Technical Indicator for the stop distance and Account Info → Balance for the risk budget, and the same graph adapts to a 2-digit or 3-digit gold quote without edits.

Test on the broker's own gold

Gold histories differ between brokers more than major forex pairs do. Backtest on the exact symbol you will trade, over a period that includes a sharp trend and a spike — our MT5 backtesting guide covers the setup. On TradeSmithy Pro, server backtests take the broker symbol name exactly as the terminal knows it — XAUUSD, GOLD, XAUUSDpro.

Build your gold EA

Start free on TradeSmithy: build a strategy that reads gold's contract from the broker instead of assuming it, and export MQL5 or MQL4. On Pro, backtest it on our servers and let the AI assistant add an ATR stop or a spread filter. If you are building for a funded account, read prop firm EA rules first.

Frequently asked questions

What is the best EA for gold trading?

There is no universal one. The best gold EA is a strategy you have tested on your broker's gold, sized from balance with volatility-based stops.

What lot size should I use for gold on a $1,000 account?

With a 100-ounce contract, 0.01 lots moves about $1 per $1 of gold price. Size so that your stop distance times that value is 1–2% of the account.

Why does my EA get "invalid stops" on gold?

Gold symbols often have a larger minimum stop distance. Read it from the symbol and keep stops beyond it.

Is scalping gold with an EA a good idea?

Only if the strategy's average gain comfortably exceeds gold's spread, tested on real ticks.

Keep reading

← More from the TradeSmithy blog