Grid and Martingale EAs: How They Work and the Risks
Grid and martingale EAs are popular because their backtests often look smooth. Here is how they work, with a worked gold example, and the risks that the smooth curve can hide.
Key takeaways
- Martingale increases the position size after each loss, so risk grows much faster than the potential profit.
- Grid systems add positions as price moves against them, so one strong trend can create a very large floating loss.
- Both styles can show many small wins and then one very large loss, which a normal backtest summary can hide.
- Before running one, check the worst drawdown, the largest position it can open, and whether it has a hard stop.
In this article
- What a martingale EA does
- A worked example on gold
- What a grid EA does
- Why the backtest can look so smooth
- Risks that matter for real accounts
- Questions to ask before running one
What a martingale EA does
A martingale system increases the size of the next trade after a loss. The idea is that one eventual winner will recover all earlier losses and leave a small profit. Investopedia and broker education pages describe the same weakness: the amount you risk grows quickly, while the profit on a win stays small.
It sounds sensible when you picture a coin flip. In real markets there are limits that the idea ignores: your account balance, the broker's maximum lot size, and the spread and commission paid on every trade.
A worked example on gold
Take hypothetical numbers: gold with a 100 oz lot, a fixed $5 stop and a $5 target, starting at 0.01 lots and doubling after every loss.
| Trade | Lot size | Loss if stopped out | Total lost if every trade so far lost |
|---|---|---|---|
| 1 | 0.01 | $5 | $5 |
| 2 | 0.02 | $10 | $15 |
| 3 | 0.04 | $20 | $35 |
| 4 | 0.08 | $40 | $75 |
| 5 | 0.16 | $80 | $155 |
| 6 | 0.32 | $160 | $315 |
| 7 | 0.64 | $320 | $635 |
| 8 | 1.28 | $640 | $1,275 |
If trade 8 wins, it earns $640, which repays the $635 lost on trades 1 to 7 and leaves a net gain of just $5. If it loses as well, the total loss is $1,275. Trade 1 risked $5. Trade 8 risks $640, which is 128 times more, for the same $5 net gain.
Margin also grows. At a hypothetical gold price of $4,000 and 1:100 leverage, a 1.28 lot position needs about $5,120 of margin. See our margin and leverage guide for the formula.
What a grid EA does
A grid EA places orders at fixed price steps, for example every $2 on gold. It often adds a new position each time price moves further against the basket, then closes the whole basket when it reaches a small combined profit. In a choppy, ranging market this can win very often, because price keeps returning to the average level.
The danger is a strong one-way trend. The basket keeps adding positions while the floating loss grows. Some grid EAs combine this with martingale lot sizing, which makes the loss grow even faster.
Why the backtest can look so smooth
Both styles tend to produce many small wins and rare, very large losses. A backtest summary that shows a high win rate and a steady curve can hide the one period where the system was exposed to a huge floating loss. If the historical data did not include a trend strong enough to break it, the test simply never met the danger.
That is why the numbers to read first are maximum drawdown, the worst floating loss, and the largest lot size the EA opened during the test. Our guide to drawdown explains how to read them.
Risks that matter for real accounts
- Margin call and stop out. A large floating loss shrinks free margin. Your broker may close positions automatically at its stop-out level.
- Prop firm limits. Daily loss and maximum loss rules can end a challenge. Check how your firm measures them, including whether floating loss counts.
- Costs add up. Many positions mean more spread, commission and swap.
- Slippage and gaps. Fast moves and weekend gaps can make real losses larger than the model assumed.
For context, European regulators report that between 74% and 89% of retail CFD accounts lose money, which is why high-risk position sizing deserves extra caution.
Questions to ask before running one
- What is the largest position it can open, and is there a hard cap?
- Is there a hard stop on every position or on total account loss?
- What was the worst floating drawdown in the backtest, not only the closed-trade drawdown?
- Did the test period include a strong trend and a high-volatility period?
- Can I afford the loss if the worst case happens?
You can estimate how likely a loss limit is to be hit with our risk of ruin simulator, and size trades from your risk with the gold lot size calculator.
Frequently asked questions
Are grid and martingale EAs illegal?
No. They are legal strategies, but they carry high risk because exposure can grow quickly. Some brokers and prop firms restrict certain styles, so check the rules of the account you use.
Why do some grid EAs show such a high win rate?
Because they close baskets for small profits most of the time, and a few large losing periods are rare. A high win rate on its own says nothing about how large the occasional loss can be.
Is a fixed stop loss safer than a grid?
A fixed stop loss limits the loss on each trade to an amount you choose in advance, which makes the worst case easier to know. It does not remove risk. It can still be hit repeatedly, which is why position sizing matters.
Free tools mentioned in this article
Related guides: Margin and leverage explained, What is drawdown?, Position sizing guide.
Sources
- Martingale System: What It Is and How It Works in Investing – Investopedia
- Martingale System: What It Is and How It Works in Investing – FOREX.com
- ESMA agrees to prohibit binary options and restrict CFDs to protect retail investors – ESMA
Sources checked on 2 November 2026. Rules and figures from third parties can change, so check the original before relying on them.
More from the blog
Want to test an EA on your own platform?
Gold Rush Algo is an MT5 Expert Advisor for XAUUSD. Download the free backtest version and judge it with your own numbers before deciding anything.
