DEV Community

Cover image for Grid Trading Bot Strategy: How to Test It Before Using
Bot LAB
Bot LAB

Posted on Originally published at botlab.org.uk

Grid Trading Bot Strategy: How to Test It Before Using

A grid trading bot strategy can collect small gains while price moves sideways inside a range, but it tends to lose when price trends out of that range. To judge one honestly, test it across both sideways and trending periods, include fees and funding, and look at the worst drawdown rather than the average trade.

This guide explains how a grid works, where it breaks, and how to test it before you commit real capital.

What is a grid trading bot strategy?

A grid bot places a ladder of buy and sell orders at fixed price steps inside a range you choose. When price dips to a buy level, the bot buys. When price rises to the next level, it sells and keeps the difference.

The key settings are:

  • Upper and lower bounds: the range the grid operates in.
  • Number of grid lines: more lines mean smaller steps and more trades.
  • Order size per line: how much capital sits on each level.
  • Leverage (on futures): multiplies both gains and losses.

The appeal is simple: markets spend a lot of time bouncing around, and a grid turns that noise into many small trades. The problem is that this only holds while price stays in the range.

Why grid bots look good in screenshots

Grid bots produce a high win rate by design. Each completed buy-sell pair is a small win, so the trade list looks green.

The losses hide elsewhere:

  • Unrealised losses. When price falls, the bot keeps buying and holds a growing position that is underwater. That loss is not a "trade" until it closes, so it does not drag the win rate down.
  • Range exits. If price drops below the lower bound, the bot is fully invested and stops trading. If price rises above the upper bound, the bot has sold everything and sits out the move.
  • Fees and funding. Small steps mean fees take a large share of each gain.

So a high win rate on a grid bot says very little. See our guide on profit factor vs win rate for why.

Grid trading bot strategy: a worked example

This is a made-up illustration with simple numbers. It is not a BOTLAB result and not a forecast.

Setup: an asset trades at 100. The grid covers 90 to 110 with 10 lines, so the step is 2. Each order is 100 USDT. Fees are 0.1% per side, so a round trip costs about 0.2 USDT.

Sideways phase. Price oscillates inside the range and the bot completes 30 buy-sell cycles.

  • Gross gain per cycle: about 2 USDT (a 2% step on 100 USDT).
  • Net per cycle after fees: about 1.8 USDT.
  • 30 cycles: about 54 USDT. The win rate is 100% and the trade list looks excellent.

Trending phase. Price then falls steadily from 100 to 80, below the lower bound.

  • The bot buys at 98, 96, 94, 92 and 90, holding about 500 USDT of the asset.
  • At 80, those five positions are worth about 426 USDT, an unrealised loss of about 74 USDT.
  • Net of the 54 USDT earned earlier, the account is about 20 USDT down and still holding a falling asset.

The bot has no sell signal in this phase, because it only sells higher. At x10 leverage on a futures grid, the same move could trigger liquidation. This is why the sideways phase alone should never be the test.

How to backtest a grid bot honestly

A grid backtest is easy to flatter, so build the test to be hard on the strategy.

1. Use trending and sideways periods

Split your data into regimes: a clear uptrend, a clear downtrend, and a range. Report each separately. A grid that only works in one regime is a bet on that regime. Our grid trading bot backtest guide covers the mechanics.

2. Count unrealised losses

Mark open positions to market at every candle. Judge the equity curve, not the closed-trade list. A strategy can show 100 winning trades and a falling account.

3. Include real costs

Add maker and taker fees, slippage on fast moves, and funding payments if you trade perpetual futures. Small grid steps make these costs decisive. A step of 0.3% with 0.2% round-trip fees leaves very little margin.

4. Use a realistic fill model

Backtests often assume every line fills at its exact price. In fast markets, price jumps through levels, and your fills are worse. Test with conservative fills, such as assuming a level only fills if price trades through it.

5. Look at maximum drawdown

Ask what the deepest peak-to-trough loss was, and whether you could have held through it. Then check the sample behind it: read how many trades a backtest needs before trusting any single drawdown number.

6. Avoid tuning to the past

If you tune range, step and size until the backtest looks great, you have probably fitted noise. Test the settings on data you did not use for tuning. Our explainer on the deflated Sharpe ratio shows how many tries inflate a result.

Then run it on paper before real money

A backtest uses history. Paper trading uses live prices with simulated money, so you see how the bot behaves as conditions change, without risking capital. Run it for weeks, through at least one sharp move, before you consider anything live. Our guide to paper trading crypto futures explains how to keep that test honest.

Be careful with what paper trading cannot show: real slippage, exchange outages, and how you react during a drawdown.

What a fair result report looks like

Whatever bot you test, write the result down the way a lab would: period, number of trades, costs included, and what is still unknown.

For example, BOTLAB publishes bot results as paper trading (simulated money, real prices) with the period and trade count. One tracked bot, mr4h/long, logged 261 paper trades between 2026-08-16 and 2026-12-04 with a 62.8% win rate. It passed 4 of our 6 statistical gates (G1–G6, defined on the site), so it sits at WATCH, not ready, because the sample is too small to conclude. That is the standard to hold any bot to: a number, a date range, a trade count, and an honest verdict. You can see how we apply it on the BOTLAB platform.

Red flags in a grid bot pitch

  • A win rate shown with no drawdown.
  • Results from one calm month.
  • No mention of what happens below the lower bound.
  • "Works in any market."
  • No fees or funding in the numbers.
  • Promised monthly returns, which no honest tester can give.

FAQ

Is a grid trading bot strategy profitable?

It can be in a stable range, but there is no guarantee. Results depend on the range, the step size, fees, funding and the market regime. Trends beyond the grid bounds can produce losses larger than the small gains collected earlier.

What market is best for a grid bot?

Grid bots are designed for sideways, range-bound markets. They are weakest in strong trends and sudden crashes. Because you cannot know in advance which regime comes next, test across several.

Should I use leverage on a grid bot?

Leverage magnifies losses when price leaves the range, and liquidation can close the position at the worst time. If you test leverage at all, do it on paper first and look at the maximum drawdown, not the average trade. This is general education, not personal advice.

How many trades do I need to trust a grid backtest?

A grid generates many trades quickly, but they are highly correlated because they come from the same range. A few hundred trades from one regime is a small sample. Read how many trades a backtest needs and test more than one market phase.

Key takeaways

  • A grid bot earns small gains in ranges and takes larger losses in trends.
  • Win rate is misleading for grids because open losses are not counted.
  • Test trending and sideways periods separately and mark positions to market.
  • Include fees, slippage and funding, since small steps make costs decisive.
  • Keep leverage out of the first test and judge the maximum drawdown.
  • Paper trade on live prices before considering real money, and report period and trade count.

Paper trading results are simulated. Past results don't predict future results. Crypto trading can lose money, including all capital. Not financial advice. Not available in restricted jurisdictions (see the Service Agreement). You trade with your own exchange account; BOTLAB never holds funds.

Want these checks run on your own strategy? See the strategy and backtest audit.


Originally published on BOTLAB. Score your own bot's trade log free: Check your bot.

Top comments (1)

Collapse
 
alicexixi85 profile image
Dejun (Alice) Chen •

The worked example makes a case for testing the exit as part of the grid. The 74 USDT hole comes from the bot having no rule for "the range is gone". A preset stop below the lower bound, or a regime filter that pauses new buys once the trend turns, changes the trending phase from open-ended to a known number, and that number is the one you want in the drawdown column. It will cost some sideways gains when the filter misfires, and the regime split you describe is exactly what would show how much.