Grid trading bot: how it harvests a range (and when it breaks)
A grid bot is the most popular automated strategy in crypto, and for a good reason: it makes money from volatility without predicting direction. It lays a ladder of buy and sell orders across a price range and mechanically buys each dip, sells each pop. This guide breaks down exactly how a grid works, the profit-per-grid math, the one market condition that destroys it, and how to set the parameters that matter.
How a grid bot works
You pick a price range and a number of grid lines. The bot places limit buys below the current price and limit sells above it, evenly spaced. Every time price drops to a buy rung it accumulates; every time it rises to a sell rung it takes profit and re-arms the buy below. No forecast required — it monetizes oscillation itself.
The profit-per-grid math
Each grid level captures the spacing between rungs, minus fees on both sides. If your range is 5% wide split into 10 grids, each rung is ~0.5% apart. After a 0.1% round-trip fee, each completed cycle nets ~0.3%. The edge is small but repeats every time price crosses a rung — volatility is literally the fuel.
Grid profit = (rung spacing − round-trip fees) × number of completed cycles. More oscillation, more cycles, more profit — until price escapes the range.
The parameters that decide everything
| Parameter | Effect |
|---|---|
| Range (upper/lower) | Where the grid operates; a breakout past it strands the bot |
| Grid count | More rungs = smaller, more frequent profits + more fees |
| Capital per grid | Position size at each rung; controls total exposure |
| Grid type | Arithmetic (equal $) vs geometric (equal %) spacing |
When it wins, when it breaks
- Wins: choppy, range-bound, volatile markets — crypto's natural default for long stretches.
- Breaks: strong one-way trends. If price runs above the range, the bot sold too early and missed the move; if it crashes below, you're left holding bags bought on the way down.
A grid's worst enemy is a trend. Set a stop below your range, or use a wide range you're comfortable accumulating across, so a breakdown doesn't leave you holding a falling knife.
Setup sketch
python · grid.pylow, high, n = 90, 110, 10
step = (high - low) / n
levels = [low + i*step for i in range(n+1)]
for lv in levels:
if lv < price: ex.create_limit_buy_order(sym, qty, lv)
if lv > price: ex.create_limit_sell_order(sym, qty, lv)
Test the grid before you fund it
Select the Grid (range) strategy on our backtester and compare a sideways market against a trending one — you'll feel exactly why grids thrive in chop and bleed in trends.
Frequently asked questions
Are grid trading bots profitable?
They can be in sideways, volatile markets where price oscillates within a range — that's their ideal habitat. They lose in strong trends, when price escapes the grid. Match the grid to a ranging market and set a stop, and the math works.
What is the best market for a grid bot?
Range-bound, choppy, high-volatility markets. Crypto pairs that trade sideways for weeks are classic grid territory. Avoid running a tight grid into a strong trend, where it sells winners early or accumulates a crash.
How many grid levels should I use?
More levels mean smaller, more frequent profits but more fees; fewer levels mean larger, rarer ones. A common starting point is 8–20 levels across a range you expect price to oscillate within. Backtest before committing.
Can a grid bot lose money?
Yes. If price breaks out of the range, the bot either sells too early in an uptrend (missing gains) or keeps buying into a crash (holding losses). Always pair a grid with a stop or a range you're comfortable accumulating across.