Strategies and backtests

Grid trading bot: backtested in a range, and in a trend

A grid trading bot buys low and sells high inside a set range, over and over. We ran the same grid on BTC during a 60-day range, a 60-day fall and a 60-day rally to see exactly where it earns and where it loses.

[

November 16, 2026

]
•
[

14

 

min to read

]

The short answer

A grid trading bot places buy and sell orders at fixed price steps across a range, buying small dips and selling small rises. It earns often while the price stays inside its range, and falls short when the range breaks: selling out to cash and missing a rally, or buying all the way down into a loss it still holds.

What is a grid trading bot?

A grid trading bot splits a price range into evenly spaced lines and places a standing order at each one: buy at the lines below the current price, sell at the lines above it. Whichever line the price touches next, it fills, and the bot immediately arms the opposite order one line away, ready to fill again the next time the price crosses it. It never asks whether the asset is a good buy. It only asks where the price sits inside its grid. That makes it one of the common kinds in our guide to trading bots, and the opposite of dollar-cost averaging, which buys on a calendar whatever the price.

That makes it a bet on movement, not direction: a grid earns from a price that keeps crossing its lines back and forth, whichever way it is headed on any single day. The trade-off is the one this guide backtests: a grid has no view on whether the price will still be inside its range next week, and when it is not, the same mechanism that earned small, steady amounts stops helping.

The terms

Grid trading terms
TermWhat it means
Grid lineOne price level in the ladder, set when the grid is built.
SlotThe money and, once bought, the coins sitting between two adjacent lines.
RangeThe highest and lowest line; set from recent prices, by hand or by a rule.
FillOne buy or one sell at a line.
Round tripA slot’s buy and its matching sell, together.

How does a grid trading bot actually place its trades?

Picture ten lines spread evenly across a range, with nine slots of equal money between them. At the start, the slots whose line sits below the current price are empty, waiting to buy; the slots above it hold inventory already, waiting to sell. From there the loop is the same every time: price falls to a line with an empty slot above it, the bot buys; price rises to a line with a filled slot below it, the bot sells and re-arms that slot to buy again if the price comes back down.

Each round trip is small on purpose. The gap between two adjacent lines is a few percent of the price (4.7% in the range test below), so one fill rarely earns much. The bot’s edge, if it has one that day, comes from doing this often, not from any single trade being large.

Building one by hand, and why it usually needs a bot

Hyperliquid’s own order types include a scale order: “multiple limit orders in a set price range,” placed in one action. That covers the first half of a grid, the opening ladder. It does not re-arm itself: once a scale order’s legs fill, they are done, so keeping a grid running, buying low and selling high over and over as price moves back and forth, takes a bot or an agent that watches each fill and places the next order, which is why “grid bot” rather than “grid order” is the usual term. Our guide to Hyperliquid trading bots covers hosted options that do this for you.

A grid is one of several fixed rules traders automate and leave running. Our wider backtest of six automated setups tests the same grid design alongside trend-following, breakout and dip-buying rules over one shared window, if you want to see how it compares with rules that do take a view on direction.

How did we test a grid trading bot on real prices?

We built one grid and ran it, unchanged, on three 60-day stretches of BTC chosen to put it in a different kind of market each time:

  • The grid. 10 lines spread evenly across the highest high and lowest low of the 30 days before each window starts, 9 slots of equal cash, $10,000 total. A slot buys at its line and sells one line up; a line already above the opening price starts the window already bought, so the grid has something to sell from day one.
  • Costs. 0.1% of the value of every fill, to stand in for trading fees and slippage.
  • Data. Daily candles of Hyperliquid’s BTC perpetual contract, taken from Hyperliquid’s public API on November 16, 2026, standing in for spot BTC’s price: Hyperliquid’s funding exists to keep a perpetual’s price close to the underlying asset’s. A day’s high and low can both be crossed within the same candle; since a daily candle does not say which came first, we assume the low came first on a day that closed up and the high first on a day that closed down, the same convention our wider setups backtest uses.
  • How we picked the three windows. We scored every 60-day window on BTC, ETH, SOL and HYPE by how much of its price range was one-way drift: the window’s net move divided by its high-low range, with at least a 5% range to count. A score near zero is a range; a score near one is close to a straight line. The single most extreme window anywhere in the data was a 223% SOL rally in late 2023, which we judged too wild to show what settings matter. BTC, by the same rule, supplied a clean range and two clean trends, up and down, so every example below is the same asset.

This is a long-only, fully cash-backed simulation that holds the coins themselves. There is no leverage, so no liquidation, and no funding, the hourly payment between a perpetual’s longs and shorts, which applies only to a perp position. Ethy’s own Accumulation Grid template trades spot tokens, which never carry funding either.

Where did the grid earn, and where did it lose?

Same grid, same costs, three different 60-day stretches of BTC:

The same 10-line BTC grid in a range, a fall and a rally, 60 days each, after a 0.1% cost per fill
WindowDatesGrid returnGrid’s worst dropBuy and holdRound tripsStill open
RangingMarch 6 to May 4, 2024+7.7%−2.9%−0.2%14 (14 won)2 of 9 slots
Trended downOctober 7 to December 5, 2025−21.4%−25.4%−28.5%13 (13 won)9 of 9 slots
Trended upSeptember 12 to November 10, 2024+7.4%−1.7%+40.3%15 (15 won)0 of 9 slots
$7,000$8,000$9,000$10,000$11,000Day 0Day 29.5Day 59RangingTrended downTrended up$6,000$8,000$10,000$12,000Day 0Day 59RangingTrended downTrended up
Value of the same $10,000 grid, day by day from the start of each window: a 60-day range, a 60-day fall and a 60-day rally on BTC. A simulation on past data.Daily candles of Hyperliquid’s BTC perpetual contract, taken November 16, 2026; Ethy’s calculation.

The grid beat both cash and buy and hold only in the range: up +7.7% while BTC itself moved almost nowhere net. In both directions away from a range, it fell short, though not the same way. Falling, it ended −21.4%, worse than sitting in cash but better than buy and hold’s −28.5%, because it started in cash and bought one line at a time on the way down, not all at the top. Rallying, it made a small +7.4% and then stopped, while buy and hold made +40.3%: the grid ran out of grid.

How did the grid do when BTC traded sideways?

From March 6, 2024 to May 4, 2024, BTC opened at $63,918 and closed the window at almost the same price, −0.2% for buy and hold, while swinging through a much wider band along the way. That gap, between a flat net move and a wide range, is exactly what a grid is built to collect: it closed fourteen round trips, every one of them a winner, averaging +4.88% each, for a total of +7.7% with only a −2.9% drop along the way, far gentler than BTC’s own swings.

Its first round trip bought at $63,358 and sold at $66,376 the same day, March 6, 2024, for +4.55%; its last bought at $60,341 on April 30 and sold at $63,358 on May 4, 2024. Two of its nine slots were still holding bought coins when the window ended, worth −1.6% each on average: a reminder that even in its best case, a grid can end a window holding a small loss on whatever it bought last.

What happened to the grid when BTC fell hard?

From October 7, 2025 to December 5, 2025, BTC opened the window at $124,711, near its peak for the window, and closed at $89,294, down 28.5%. None of the grid’s nine slots started bought, since the price opened at the very top of its own range. As BTC fell, slot after slot bought in behind it, and thirteen of those buys even closed for a small gain before the fall resumed, averaging only +1.57% each, a fraction of the ranging window’s average round trip, because the band each line covers is much narrower next to BTC’s price at these levels.

What matters more is what did not sell. By the close, all 9 slots were still holding BTC bought on the way down, worth −23.2% each on average, as deep as −28.2% on the one bought highest. Every closed round trip in this window was a winner, which would look, from the trade log alone, like a strategy with no losing trades at all. The account was still down 21.4%, because a 100% win rate on the trades that did sell says nothing about the inventory still sitting unsold.

What happened to the grid when BTC rallied instead?

From September 12, 2024 to November 10, 2024, BTC opened at $57,287 and closed the window at $80,458, up 40.3%. This time the grid’s trouble was not holding losers; it was running out of sellers. Price pushed through the grid’s top line on October 14, just past the window’s halfway point, and from then on every slot was empty and every line was below the market, with no upper line left to sell into and no reason for price to fall back to a buy line. The grid finished the window exactly as it started that day: fully in cash, earning nothing more while BTC kept climbing.

By the close it had made +7.4% from fifteen completed round trips, all winners, averaging +4.30% each. Buy and hold made +40.3%. The grid was not wrong about any single trade; it simply had nothing left to do for the back half of a rally it had no way to see coming.

Which grid settings actually change the result?

Two settings decide most of what a grid does: how many lines it has, and how wide a range those lines cover. We reran all three windows with more and fewer lines, and with the range set from a shorter and a longer stretch of prior prices:

The same BTC windows with more or fewer grid lines, and a shorter or longer lookback for the range
SettingRangingTrended downTrended up
5 lines, 30-day range+3.2%−19.9%+6.8%
10 lines, 30-day range (baseline)+7.7%−21.4%+7.4%
20 lines, 30-day range+5.4%−22.4%+6.6%
10 lines, 14-day range+9.3%−21.4%+3.2%
10 lines, 60-day range+5.8%−20.4%+10.0%
5 lines+3.2%10 lines+7.7%20 lines+5.4%5 lines+3.2%10 lines+7.7%20 lines+5.4%
Return of the ranging-window backtest with 5, 10 and 20 grid lines, March 6, 2024 to May 4, 2024. A simulation on past data.Daily candles of Hyperliquid’s BTC perpetual contract, taken November 16, 2026; Ethy’s calculation.

More lines means more, smaller trades, not more profit

Going from 5 to 10 lines helped in the range, because the finer grid caught more of the back-and-forth. Going on to 20 lines gave some of that back in every window we tested, in the range and in both trends, because each of its slots held about half as much money and sold only half as far above its buy, so a swing the 10-line grid caught in full paid the 20-line grid about half as much. A finer grid comes out ahead only on swings too small to reach a coarser grid’s next line.

The lookback sets how much room the grid has, which cuts both ways

A shorter, 14-day lookback helped in the range: a tighter band that matched the market’s recent, narrower swings caught more round trips. The same short lookback hurt in the rally, because a narrower range gave the grid less room above the price, so it ran out of upper lines and sold out to cash even sooner. A longer, 60-day lookback did the opposite in each case: it gave up some of the range’s extra round trips, but in the rally it gave the grid more room above the start price, so it rode further before running out of lines. Neither setting won in every window. Whatever sets your range, know what it assumes about how far the price might move before it gets there.

Does Ethy have a grid trading template?

Ethy is an AI trading agent you ask before you trade. Its Strategy Library includes an Accumulation Grid template, which trades spot tokens rather than a perpetual contract, so it never carries funding or a liquidation price. It is not set up the same way as the custom grid tested in this guide, so read its exact rules in the preview before you judge it against anything above. Ethy’s grid bot shows how its ladder fills and when it sells.

  • Backtesting your own grid-style rule. Describe it in plain English and Ethy will show the rules it built before testing them, so you can check the range and the number of levels.
  • Paper mode. Run a grid-style automation on live prices with no money moving, to see how it handles the market’s actual swings before it trades for real; our paper trading guide has a 30-day plan for that.
  • Reading the market first. Before you set a range, it helps to know whether a market looks like it is ranging or trending right now, which is a question you can ask Ethy directly.

Ethy is software for research and analysis. It does not give investment advice, and nothing here is a recommendation to run a grid on any particular market. Automated trading bots are also a common subject of overpromising: the CFTC’s customer advisory warns that promises of outsized or sure-thing returns are red flags of fraud, and FINRA warns that some auto-trading services “promote vague and unverified claims of impressive past market returns.” A backtest like this one, dated and showing its losses as plainly as its gains, is the opposite of that kind of claim.

Summary

  • The same 10-line, 0.1%-cost BTC grid earned +7.7% over a 60-day range (March 6, 2024 to May 4, 2024), where BTC itself moved −0.2%.
  • In a 60-day fall (October 7, 2025 to December 5, 2025), the grid lost 21.4%, less than buy and hold’s 28.5% loss, but ended with every slot still holding BTC bought on the way down.
  • In a 60-day rally (September 12, 2024 to November 10, 2024), the grid made only +7.4% against buy and hold’s +40.3%, because it sold out to cash just past halfway and had nothing left to sell into the rest of the move.
  • A 100% win rate on closed round trips said nothing about the account’s total return in the falling window: the trades that sold all won small; the ones still open were the loss.
  • Going from 5 to 10 grid lines helped in the range, but 20 lines gave some of that back in every window; a wider lookback gave the grid more room in a rally but fewer fills in a range. Neither setting won in every market.
  • Ethy’s Accumulation Grid template trades spot tokens, with no funding or liquidation, and is not the same grid tested here; you can backtest and paper-trade your own version first.

Questions people ask

Does grid trading work in crypto?

It can, specifically while a market trades inside a range: our backtest made +7.7% on a 60-day BTC range. The same grid lost money when BTC fell hard and trailed far behind buy and hold when it rallied hard, so “does it work” depends entirely on whether the market stays inside the grid’s range.

What is the best grid trading bot setting?

There is no single best setting across every market. In our tests, 10 lines beat both 5 and 20 in the range; a narrower range caught more trades in a range but ran out of room sooner in a rally. Match the range to how far you think the price could realistically move, and expect to be wrong sometimes.

Can a grid bot lose money?

Yes, when the price falls through the whole grid: every slot ends up holding coins bought on the way down, worth less than they cost. When the price rises through the whole grid, it keeps its gains but falls behind: every slot sells out to cash and earns nothing further while the price keeps climbing without it.

How many grid lines should I use?

Our tests used 10 lines (9 trading slots) as a baseline and compared 5 and 20. Going from 5 to 10 helped in a range; going on to 20 gave some of that back everywhere we tested, because each of its smaller slots earns only the narrow gap to the next line. Past a point, more lines mean more trades, each earning less.

Is a grid trading bot the same as DCA?

No. DCA (dollar-cost averaging) buys a fixed amount on a fixed schedule and never sells. A grid buys and sells repeatedly inside a price range on no fixed schedule at all, trading only when the price actually crosses one of its lines.

Does Ethy have a grid trading bot?

Ethy’s Strategy Library includes an Accumulation Grid template for spot tokens, which you can preview, backtest and run on paper before it trades for real. It is not configured the same way as the custom grid tested in this guide.

Sources

  1. Hyperliquid Docs: Order types (scale order, TWAP)hyperliquid.gitbook.io
  2. Hyperliquid Docs: Liquidationshyperliquid.gitbook.io
  3. Hyperliquid Docs: Info endpoint (candle snapshot)hyperliquid.gitbook.io
  4. Hyperliquid Docs: Fundinghyperliquid.gitbook.io
  5. CFTC, Press Release 8854-24 and Customer Advisory: AI Won’t Turn Trading Bots into Money Machines (January 25, 2024)cftc.gov
  6. FINRA: Know the Risks of Auto-Trading Services Offered by Unregistered Entities (July 29, 2025)finra.org

Trading involves risk, including the loss of your money. Ethy AI is a research and trading tool and does not give investment advice or recommendations. Backtests are simulations on historical data and do not predict future results.

Ethy blog

Read more

The $ETHY ecosystem

Stop watching charts.
Start living.

Deploy your AI trading agent in one click.