EzoOBOTS← Back to site

EzoO Bots › Guides

What is a grid EA? Grid and martingale explained

Updated 4 October 2026 · EzoO Bots

A grid EA opens a series of trades at fixed price steps and closes them all together. It is one of the most popular types of Expert Advisor for gold (XAUUSD), and also one of the most misunderstood. Here is how it works, with real numbers, and what can go wrong.

The basic idea

The EA opens a first trade. If price moves against it by a set distance (the grid step), it opens another trade in the same direction at the better price. It keeps doing this as long as price keeps moving away. All open trades form one basket.

Because the later trades were opened at better prices, the basket does not need price to go all the way back to the first entry. It only needs a small move back.

Breakeven and the basket take-profit

The breakeven price is the average entry price of the basket, weighted by lot size. When price reaches it, the whole basket is roughly at zero. The basket take-profit is set a little above breakeven for a buy basket (below it for a sell basket). When price reaches it, the EA closes every trade at once and starts again.

In EzoO Frame the default basket take-profit is 150 points above breakeven. On gold, where one point is usually $0.01, that is $1.50 of price movement.

Where martingale comes in

A pure grid uses the same lot for every trade. A martingale grid multiplies the lot each time, so the newest trades are the biggest. That pulls the breakeven much closer to the latest price, so the basket can close on a small bounce. The cost is that the total position grows quickly.

Here is how lots grow from a 0.01 starting lot:

MultiplierL1L2L3L4L5L6L7L8Total
× 1.30.010.010.020.020.030.040.050.060.24
× 2.00.010.020.040.080.160.320.641.282.55
× 3.00.010.030.090.270.812.437.2921.8732.80

With a ×3 multiplier, eight levels already mean more than 32 lots open at once. That is why a grid EA needs a large enough balance and firm limits.

The real risk

A grid EA does well when price moves back and forth, which gold does most of the time. The danger is a strong move in one direction that does not come back soon enough. The basket keeps growing, the floating loss grows faster, and the account can run out of margin. A long run of small wins can be wiped out by one such move.

Risk warning. Trading gold, forex and other leveraged products can lose your whole balance. Grid and martingale strategies add bigger positions as price moves against them. Test on a demo account first and only trade money you can afford to lose. This guide is education, not investment advice.

How to control it

Backtests and how to read them

Before running a grid EA on real money, test it in the MetaTrader 5 Strategy Tester over at least a full year with "Every tick based on real ticks". Look at the maximum drawdown first, not only the profit. Our own test results, with the exact settings, are published on the results section of the home page.

Try EzoO Frame free for 3 daysRun it on your own MT5 account before you decide. The licence key is emailed to you in a minute.
Start the free trial

More guides