Gold EAs
XAUUSD EA Settings Explained: Lot Size, Stop Loss, Spread Filter, Trading Hours and More
By Benjamin Lee · Updated · 8 min read
People search for the best XAUUSD EA settings hoping for a magic set of numbers. There is none. The settings that suit a 10,000 euro account on a raw-spread broker will hurt a 500 euro account on a standard one. What you can do is understand every input on a gold EA, work out the risk each one creates, and size them to your own account. This guide goes through the inputs one by one, with worked examples in euros.
Key takeaways
- Start from the vendor's setfile, then change risk inputs only, one at a time, and record each change.
- One 0.01 lot of gold is 1 ounce at most brokers, so a 1 dollar move is about 1 dollar. Always verify at your broker.
- A spread filter and a trading-hours filter protect you more than any entry tweak.
- Set the maximum slippage low enough to refuse a bad fill, but not so low that the EA never trades.
- Test every change in the Strategy Tester on real ticks before it touches a live account.
Before you change anything
The setfile that ships with an EA is the author's starting point for a given symbol, timeframe and risk profile. Load it first, as described in our setfile guide, and attach the EA to the chart and timeframe named in the manual. Then save a copy of the untouched setfile so you can always go back.
Next, find out how your broker quotes gold. Right-click XAUUSD in Market Watch and open Specification. Note the contract size (usually 100 ounces), the digits (usually 2), the minimum lot, the lot step and the stops level. Many brokers add a suffix such as XAUUSD.m or GOLD, and some EAs need that exact name typed into an input.
Lot size and risk per trade
This is the input that decides whether a bad week is an annoyance or a disaster. Many gold EAs offer either a fixed lot or a risk percentage that works out the lot from the stop distance. A risk percentage is safer, because it adapts as the account changes and as the stop distance changes. Whatever you choose, check the money at risk for one losing trade.
| Lot size | Ounces | Loss at 10 dollar stop | In euros | Share of 1,000 euros |
|---|---|---|---|---|
| 0.01 | 1 | 10 dollars | about 8.70 euros | about 0.9% |
| 0.02 | 2 | 20 dollars | about 17.40 euros | about 1.7% |
| 0.05 | 5 | 50 dollars | about 43.50 euros | about 4.3% |
| 0.10 | 10 | 100 dollars | about 87 euros | about 8.7% |
The jump from 0.01 to 0.10 looks small on screen and is a tenfold change in risk. Many people aim to keep one trade near 1 percent of the account or less. On this account only the smallest lot sits near that level with a 10 dollar stop, which tells you something important: a small account either needs a smaller stop or is too small for that EA. The gold lot size calculator does this sum for any lot, stop and exchange rate, and how much money you need to run an EA works through it for several account sizes.
Stop loss, take profit and trailing
Prefer an EA that puts a hard stop loss on every position at the moment it opens the trade. A stop that is only managed by the EA's code disappears if the terminal disconnects. When an EA lets you change the stop, think about what gold normally does, not what looks neat. A stop that is smaller than the typical swing of a few minutes will be hit by noise, and a very wide stop turns every loss into a big one.
- Check the stop distance against the broker's minimum stops level and against the spread. A stop that is only a few times the spread loses a large share of each trade to costs.
- If the EA offers a trailing stop, test it. Trailing can improve some systems and ruin others, because gold often retraces before it continues.
- A fixed take profit is predictable. A variable one that depends on volatility needs more testing across different weeks.
- Leave the risk-to-reward ratio the author chose until you have a reason, and test any change on separate periods rather than the same one you used to choose it. Our overfitting guide explains why.
Spread filter and slippage
Gold's spread is not constant. It can be tight in the London morning, widen at the daily rollover, and jump during a news release. A maximum spread input tells the EA not to open a trade when the spread is above your limit. It is one of the most useful protections on any gold EA.
Choose the limit from your own broker's data. Watch the Spread column in Market Watch over a few days and note the normal range. Set the limit somewhat above the normal value but below the spikes. If you set it too tight the EA will sit idle, and if you set it too loose the filter does nothing. A useful test is to compare the spread to the EA's target: a 0.30 dollar spread against a 3 dollar target gives away a tenth of the move before the trade starts.
Slippage, often called deviation or maximum slippage, is how far from the requested price the EA will still accept a fill. Too tight and the broker rejects orders in fast markets. Too loose and you accept poor fills in exactly the moments that matter. Keep it near the value in the setfile, then compare real fills against the backtest after a few weeks of live trading. Our guide to spread, slippage and swap explains how each one hits a result.
Trading hours, server time and news
EA time inputs usually run on broker server time, not on your local time. Many MT5 brokers use a server clock of GMT+2 in winter and GMT+3 in summer, so that the daily candle closes with the New York close. Look at the time shown in Market Watch, compare it with the time in your country (for example Central European Time) and convert the EA's hours accordingly. Daylight saving changes do not happen on the same date in Europe and the United States, so for a couple of weeks a year the gap between your time and server time shifts.
- Use the session filter to avoid the daily rollover, when spreads widen and liquidity is thin.
- A news filter pauses trading around high-impact releases. If the EA has none, switch it off yourself before major events such as US inflation data, central bank decisions or employment reports.
- Check the Friday behaviour. An EA that holds positions over the weekend is exposed to a gap on Monday, and a close-before-weekend option removes that risk at the cost of some trades.
- Gold also reacts to European events and the euro, so expect extra movement around European Central Bank meetings.
Other inputs worth understanding
| Input | What it does | How to choose |
|---|---|---|
| Magic number | Tags the EA's own orders so it can tell them from other trades | Use a different number for every EA and every chart. See the magic number guide. |
| Max open trades | Caps how many positions can be open at once | Lower is safer. Add up the risk of all positions if they all lose together. |
| Symbol name or suffix | Tells the EA which instrument to trade | Copy the exact symbol from Market Watch, including any suffix. |
| Order filling mode | How the broker may fill an order | If trades are rejected with an invalid fill error, change it. See the errors guide. |
| Daily loss or equity stop | Stops trading after a loss limit is reached | Set it to a figure you decided in advance, well inside any prop firm limit. |
| Timeframe | The chart period the logic was designed for | Use the one in the manual. A different timeframe is a different strategy. |
| Hedging allowed | Whether the EA may hold opposite positions | Needs a hedging account. Check the account type first. |
How to test a change safely
Step 1: Change one thing at a time
If you change five inputs and the result is better, you do not know which one did it. Record the old and new value of each change.
Step 2: Backtest on real ticks with your broker's spread
Use the Strategy Tester mode that is based on real ticks, as described in how to backtest an EA in MT5.
Step 3: Test a second, unseen period
A setting that only works on the period you tuned it on is probably overfitted. Check it on a different year or a different month.
Step 4: Forward test on demo
Run the new settings on a demo account for a few weeks, through at least one news week, before going live.
Step 5: Go live small
Start with the minimum lot and compare real fills, spread and slippage with the demo.
Sources and further reading
- MetaTrader 5 Help: Strategy TestingThe Strategy Tester: testing modes, settings and forward testing.
- MetaTrader 5 Help: Real and Generated TicksThe difference between ticks recorded from the broker and ticks the tester generates.
- MQL5 Reference: Trade Server Return CodesWhat the codes returned for a refused trade request mean, including 10027.
Frequently asked questions
What are the best settings for a gold EA?
There is no universal best. Start from the vendor's setfile, then adjust the risk inputs to your account: lot size or risk percentage, maximum spread, trading hours and a daily loss stop. Test every change on real ticks and on demo.
What lot size should I use for XAUUSD on a 1,000 euro account?
Work backwards from the loss you accept per trade. At about 1 percent, or 10 euros, a stop of a few dollars on the smallest lot is the realistic range. Use the gold lot size calculator with your own stop and exchange rate rather than a fixed rule.
What spread should I allow for a gold EA?
Watch your broker's normal range over several days, then set the limit a little above it and below the spikes. Compare the limit to the EA's profit target, since a wide spread gives away a large share of each trade.
Which timeframe is best for a gold EA?
The one the author designed it for. Switching the timeframe changes the strategy, so the backtest and the vendor's results no longer apply.
Why does my gold EA not open trades?
The most common reasons are Algo Trading switched off, a spread or time filter blocking entries, a wrong symbol name, or an invalid filling mode. Check the Experts tab of the terminal for the exact message.
Expert Advisors in these styles
Apply the checks above to any of these before you buy: read the manual, run your own backtest, and start on demo.
Keep reading
- Gold EAsBest Gold EA for MT5: How to Choose One (Checklist)How to pick a gold (XAUUSD) Expert Advisor for MT5: strategy type, spread tolerance, drawdown, proof to ask for, and a 12-point checklist before you pay.
- Risk and sizingHow Much Money Do You Need to Run an EA? Euro ExamplesThe smallest account that can run an Expert Advisor safely: the 1% risk method, minimum lots on EURUSD and gold, margin, costs and euro examples from 500 to 10,000.
- BacktestingHow to Backtest an EA in MT5 ProperlyLearn how to backtest an Expert Advisor in MT5 the right way: tester modes, spreads, delays, optimisation, walk-forward checks and the red flags to avoid.
- Pillar guideMT5 Expert Advisors: The Complete Guide for BeginnersEverything about MetaTrader 5 Expert Advisors in one place: how they work, strategy types, risk, backtesting, buying safely, gold, EURUSD, prop firms and Europe.


