Many gold EAs show a smooth, rising backtest and then lose most of the account in a single week. The reason is usually not the entry signal but the money management behind it: martingale or grid position sizing with no real stop loss. This guide explains how martingale, grid and fixed stop-loss EAs work on XAUUSD, puts real numbers on each, and shows how to tell which one you are looking at before you run it.
Three ways an EA can handle a losing trade
Every EA has to answer one question: what happens when price goes against the position? There are three common answers.
- Martingale: close the loss and open the next trade with a bigger lot, usually double, so that one win recovers all previous losses.
- Grid (averaging down): keep the losing trade open and add more trades at fixed price steps, so the average entry price moves closer to the market.
- Fixed stop loss: every trade has a stop at a set price, and the lot size is chosen so that hitting the stop costs a fixed part of the account.
Some EAs combine the first two (a grid that also increases lot size). All the numbers below use the standard XAUUSD contract: 1 lot = 100 oz, so a 1 USD move in gold equals 100 USD per lot, or 1 USD per 0.01 lot.
Martingale on gold: the numbers
Take a simple martingale EA. It starts at 0.01 lot, uses a 10 USD stop and a 10 USD target on gold, and doubles the lot after every loss. A win at any step brings the series back to a net gain of 10 USD.
| Trade | Lot | Loss if this trade fails | Total lost so far |
|---|---|---|---|
| 1 | 0.01 | 10 USD | 10 USD |
| 2 | 0.02 | 20 USD | 30 USD |
| 3 | 0.04 | 40 USD | 70 USD |
| 4 | 0.08 | 80 USD | 150 USD |
| 5 | 0.16 | 160 USD | 310 USD |
| 6 | 0.32 | 320 USD | 630 USD |
| 7 | 0.64 | 640 USD | 1,270 USD |
| 8 | 1.28 | 1,280 USD | 2,550 USD |
After 8 losses in a row the EA has lost 2,550 USD to chase a 10 USD gain. The total after n losses is 10 × (2n − 1), so each extra loss roughly doubles the damage.
How likely is an 8-loss streak? If each trade were a coin flip (50% win rate), the chance of 8 losses in a row starting at any given point is 1 in 256. Over 1,000 trades, the chance that such a streak happens at least once is roughly 85%. Real gold trends make long streaks more likely than a coin flip, not less, because the same direction can persist for days.
Margin is the second wall. At a gold price of 4,200 and 1:100 leverage, the 1.28 lot trade needs 1.28 × 100 × 4,200 ÷ 100 = 5,376 USD of margin. A 2,000 USD account cannot even open step 8, so the series ends with the full loss and no chance to recover. You can check any lot with the margin calculator.
Grid EAs: floating loss adds up fast
A grid EA does not close the loser. Suppose it buys 0.10 lot of XAUUSD and adds another 0.10 lot every time price falls 5 USD, up to 10 positions, with no stop loss. If gold drops 50 USD from the first entry:
- The first buy is 50 USD under water: 50 × 10 USD = 500 USD.
- The second is 45 USD under water: 450 USD, and so on down to 5 USD for the last.
- Total floating loss = 10 USD × (5 + 10 + ... + 50) = 10 × 275 = 2,750 USD.
A 50 USD move is about 1.2% at a price of 4,200, which gold can cover in a single news-driven session. The grid now holds 1.00 lot in total. Every further 1 USD drop costs another 100 USD, and when equity falls far enough the broker's stop out closes the positions at the worst point. Grid EAs look excellent in ranging markets because price usually comes back; they fail in the one-way move that does not come back. Use the XAUUSD profit calculator to see what any combined lot and price move does to your balance.
Fixed stop-loss EAs: smaller wins, known worst case
A fixed stop-loss EA accepts that some trades lose and caps each loss in advance. With a 5,000 USD account, the 1% risk rule gives a 50 USD risk per trade. If the stop is 8 USD away from entry:
Lot = 50 ÷ (8 × 100) = 0.0625, rounded down to 0.06 lot (actual risk 48 USD). The gold lot size calculator does this step for any balance and stop distance.
Now apply the same 8-loss streak that broke the martingale. At about 1% per trade, recalculated on the shrinking balance, the account ends near 4,610 USD, a drop of roughly 8%. A 10-loss streak costs close to 10%. That is painful, but the account is still trading and the next setups are still sized correctly.
Side-by-side comparison
| Martingale | Grid (no stop) | Fixed stop loss | |
|---|---|---|---|
| Typical win rate | Very high | Very high | Lower, often 35-60% |
| Loss per bad series | Grows exponentially | Grows with every grid level | Fixed, about 1% per trade |
| Worst case | Whole account | Whole account (stop out) | A known drawdown |
| Backtest looks | Smooth balance line | Smooth balance line | Jagged but honest |
| Margin use | Explodes after losses | Grows with open trades | Small and stable |
There is also an opposite approach, sometimes called anti-martingale or pyramiding: add size only to a trade that is already winning, with the stop moved up first. The Turtle Channel EA works this way, adding a second unit only after the trade is 0.5 ATR in profit and never averaging down. The Supertrend Rider EA uses a single position with an ATR-based stop that trails behind price.
How to spot martingale or grid in an EA
- Read the inputs. Look for "Lot multiplier", "Multiplier", "Grid step", "Distance between orders", "Max orders" or "Recovery". A multiplier above 1.0 is martingale.
- Check for a stop loss input. If there is none, or it defaults to 0 (off), losses are open-ended.
- Look at the backtest graph. In the MT5 report, a balance line that rises smoothly while the equity line drops in deep spikes means losing trades were held open. See how to backtest an EA in MT5 for reading equity drawdown.
- Compare largest loss to average win. A largest loss that is 50 to 200 times the average win is the typical signature.
- Watch open positions on demo. Several trades in the same direction at regular price steps is a grid.
Key takeaways
- Martingale doubling from 0.01 lot loses 2,550 USD after 8 losses to recover a 10 USD target.
- A 10-level grid of 0.10 lot on gold is 2,750 USD under water after a 50 USD drop.
- Fixed-stop sizing at 1% keeps an 8-loss streak near an 8% drawdown.
- Smooth balance with deep equity spikes in a backtest usually means martingale or grid.
FAQ
Is a martingale EA safe for gold?
No. It can show months of small wins, but a long losing streak or a strong trend makes the lot size, margin and loss grow exponentially. On XAUUSD, eight losses in a row from 0.01 lot already need 1.28 lot and 2,550 USD of total losses.
What is the difference between a grid EA and a martingale EA?
Martingale closes the losing trade and opens the next one with a bigger lot. A grid keeps losing trades open and adds new ones at fixed price steps. Many EAs combine both, which adds the risks together.
Why do martingale backtests look so good?
Most series end with a win, so the balance line rises smoothly. The risk only shows in the equity drawdown and in the rare series that does not recover. A short test period may not include that series at all.
Can a grid EA work with a stop loss?
Yes. A grid with a basket stop (close all positions at a fixed total loss) and a cap on the number of levels has a known worst case. Size it so that the full basket loss is an amount you accept, not the whole account.
How much should a stop-loss EA risk per trade?
Many traders use 0.5% to 2% of the balance per trade. At 1%, ten losses in a row cost about 10%, which a strategy with a real edge can recover from.
For education only, not investment advice. Trading gold and CFDs is high risk and you can lose your capital.