Anello Team · Nov 5, 2026 · 6 min read
How to Backtest a Grid Bot Before You Launch It
Backtest a grid bot by replaying your exact range, levels and order size over past prices with fees, then compare total P&L, drawdown and buy and hold.
To backtest a grid bot, replay your exact settings over a past window of prices, with fees, before you commit money. Use the same range, level count and order size you plan to launch with. Then read three numbers: total P&L against buy and hold, max drawdown, and fees paid. Run more than one window, and treat the result as a check on your settings, not a forecast.
A grid bot places buy orders below the current price and sell orders above it, and each fill places the opposite order one rung away. If that is new, start with what grid trading is. This post covers how to test a grid on past prices, what the replay can and cannot tell you, and how Anello’s backtest works on Hyperliquid, a decentralized exchange.
What is a grid bot backtest?
A grid bot backtest is a simulation of your grid’s orders on historical prices. It starts the grid at the window’s first price, fills orders when past prices trade through them, places counter-orders the way the live bot would, and charges trading fees. At the end it reports what the account would have been worth.
The point is to catch problems before they cost money. A backtest answers questions like:
- Did price spend most of the window inside my range, or outside it?
- Is the step between rungs wide enough to beat fees?
- How far did the account fall at its worst point?
- Would I have done better simply holding the asset?
How do you backtest a grid bot step by step?
Set up the grid exactly as you would launch it, run the replay over a few windows, and compare the results against holding. Changing one setting at a time makes each run comparable.
- Pick the range and levels. Start from where price has actually traded. How to choose a grid trading range covers the bounds and level count.
- Set the order size. Use the USD per order you plan to run. Fees and rounding scale with it.
- Run a short window. Seven days shows how the grid handles current conditions.
- Run a long window. Ninety or 180 days usually includes a trend or a breakout, which is where grids hurt.
- Change one thing and rerun. Try a wider range or fewer levels, then compare the same window.
- Compare against buy and hold. If holding beat the grid in most windows, that is worth knowing before launch.
What numbers should you look at?
Look at total P&L first, then max drawdown, then fees. Grid profit on its own can mislead.
| Result | What it tells you |
|---|---|
| Grid profit | Realized profit from completed sells, after fees |
| Total P&L | Everything held at the end, minus the starting position |
| Buy and hold | The same starting value put into the asset at the first price |
| Max drawdown | The largest fall in account value from a previous high |
| Fees paid | Every fee in the run |
Grid profit can be positive while total P&L is negative. If price falls through the range, the grid keeps buying on the way down. It books small profits on each bounce, but it ends the window holding inventory worth less than it paid. Total P&L counts that inventory at the final price, which is why it is the number to judge by. How grid bot PnL is calculated explains the same split for a live bot.
Max drawdown is the number to accept before launch. It is the worst dip you would have sat through. If that figure would make you stop the bot in a panic, the range is too wide or the order size too large.
Fees show whether the step is too tight. At Hyperliquid’s base spot tier, a maker fill costs 0.040% (Hyperliquid fees, checked November 1, 2026). Take a $50 rung with a 1.83% step. The buy pays about $0.02 and the sell pays about $0.03 including Anello’s 0.02% fee on spot sells, against roughly $0.92 of gross profit per cycle. At a 0.3% step the same fees take more than a third of each cycle.
Why do backtest results differ from live trading?
Backtests run on candles, and candles hide the path price took inside them. A candle records only open, high, low and close. The replay has to assume an order of events, and the real market may not have followed it.
Anello’s replay assumes the shortest path: open, low, high, close for an up candle, and open, high, low, close for a down candle. Here is what that means for one up candle that opens at $100, dips to $98, rallies to $103 and closes at $102, with a buy resting at $99:
- On the way down to $98, price trades through $99, so the buy fills.
- The counter-sell is placed one rung up, at about $100.81 with a 1.83% step.
- On the way up to $103, price trades through $100.81, so the sell fills too.
If price had really gone up first and down later, the buy would still fill but the sell would not, and the live result would differ. A price that only touches a limit does not count as a fill, which keeps the replay on the cautious side. Finer candles reduce the problem, so short windows are more precise than long ones.
Other gaps to keep in mind:
- Fee tier. The replay uses Hyperliquid’s base spot tier. A higher-volume account pays less.
- Queue position. Live limit orders wait in line behind others at the same price.
- The future. Every backtest is in the past. A range that worked last month can sit outside the price next month.
How do Anello’s grid backtests work?
Anello replays your grid’s exact orders over the last 7, 30, 90 or 180 days of Hyperliquid prices, with fees. Open advanced on the grid setup panel, pick a window and run it. The chart marks simulated buys and sells, and the results appear in the panel. Backtesting is free and places no orders.
Each window runs on the finest candles that cover it, because Hyperliquid keeps about 5,000 candles per interval (Anello backtests docs):
| Window | Candles used for fills |
|---|---|
| 7 days | 3 minute |
| 30 days | 15 minute |
| 90 days | 30 minute |
| 180 days | 1 hour |
The grid starts with the same order prices and sizes the preview shows, rounded to Hyperliquid’s tick and lot rules, and with the funding the preview asks for: USDC for the buys and the asset for the sells. Counter-orders follow the running bot’s rules. Fees use the base spot tier, 0.04% maker on every grid fill, plus Anello’s 0.02% fee on sell fills. The candle that is still open is left out, and if a pair has less history than the window, the replay starts where its history starts and says so.
The backtest only shows results. It never ranks settings or suggests a range. The same replay is available for scheduled buys on the Hyperliquid DCA bot, where each purchase fills at the open of its candle and pays the base taker fee.
What should you do after the backtest?
Launch only if the worst case in the replay is one you can hold through. When you are ready, the Hyperliquid grid bot preview lists every order’s price and size, which are the orders the bot places. The bot trades through a revocable agent wallet that can place and cancel orders but cannot withdraw. Grid bots can lose money, mostly by holding inventory after price falls below the range. Read the risks of grid trading before you commit capital.
Sources
- Anello docs: Backtests
- Hyperliquid: Fees (checked November 1, 2026)
- Anello docs: Fees and risks
Nothing in this article is financial advice. Backtests replay past prices and are not predictions, and grid trading can lose money.
Frequently asked questions
- What does it mean to backtest a grid bot?
- Backtesting a grid bot means simulating its orders on prices that already happened. The replay places the same buy and sell orders the bot would place, fills them when past prices trade through them, and charges fees. The result shows how those settings would have behaved in that window.
- How far back should I backtest a grid bot?
- Test more than one window. A short window shows how the grid handles recent conditions, and a long one shows what happens when price trends out of the range. On Anello you can replay the last 7, 30, 90 or 180 days of Hyperliquid prices.
- Is a profitable backtest a good sign?
- It is a sign the settings fit that past window, nothing more. A grid earns when price keeps crossing its rungs, and a market that ranged last month can trend next month. Use the backtest to rule out bad settings, not to forecast returns.
- Why do backtest fills differ from live fills?
- Candles only record open, high, low and close, not the path price took inside the candle. A replay has to assume a path, so fills inside one candle can come out in a different order or not at all compared with the live market. Fees, tiers and queue position also differ in practice.
- Does backtesting cost anything on Anello?
- No. Running a backtest is free and places no orders. Fees only apply to real fills once a bot is running.