Your numbers
What it says
Ready to go further
Next: the cost side of a grid
Profit per grid is small, so fees, spread and the time price spends outside the range decide the result. Read the guide to grid bot costs.
What is included
- The calculator, with your own numbers
- The formula written out
- A worked example you can reproduce
- Where grid, martingale and DCA bots break the maths
Who it is for
- People running or testing a trading bot
- Anyone sizing a position or checking costs
- Readers learning how the numbers work
- Not advice, and not for placing trades
Key facts
- A grid bot places buy orders at fixed price lines below the market and sell orders above it. One grid is the gap between two neighbouring lines. N lines make N minus 1 grids.
- A completed grid is a buy at the lower line and a sell at the upper line. Its profit is the gap divided by the buy price, less the fee on both fills.
- Arithmetic spacing keeps the gap in price units equal, so the percent profit falls toward the top. Geometric spacing keeps the percent equal.
- If the gap is smaller than the round-trip fees, every completed grid loses money, however busy the bot looks.
- Grid profit is earned only while price oscillates inside the range. A one-way move out of the range leaves the bot holding the asset or holding cash.
- The example numbers on this page are made up. The page calculates spot grids only, with no leverage.
How the grid calculator works
A spot grid bot divides a price range into equal steps and trades each step. When price falls to a line, it buys. When price rises to the next line up, it sells what it bought. Each buy-then-sell pair is one completed grid, and it earns the gap between the two lines, minus the fee paid twice.
Terms matter here, because bot screens use them loosely. This page uses grid lines for the price levels, including the bottom and top, and grids for the gaps between them. So 21 lines make 20 grids. If the screen of your bot asks for a "number of grids", check whether it means lines or gaps, and enter lines here.
Arithmetic spacing = (upper - lower) / grids
Geometric ratio = (upper / lower) ^ (1 / grids)
Profit per grid before fees = (sell line - buy line) / buy line
Profit after fees = (sell - buy - fee x (buy + sell)) / buy
Investment per grid = total investment / grids
The fee term charges the percentage on the money value of the buy and again on the money value of the sell. Some exchanges charge the fee in the asset instead, or give lower fees to makers, so use the rate your own account pays. Slippage and the spread are not in the formula. A grid order that rests in the book usually avoids both, but a fast market can fill it at a worse price.
A worked example
Take a made-up grid from 80 to 120 with 21 lines. That is 20 grids, and the spacing is (120 - 80) / 20 = 2 in price units, so the lines sit at 80, 82, 84 and so on up to 120. With $1,000 invested, each grid gets $1,000 / 20 = $50.
The bottom grid buys at 80 and sells at 82. Before fees it earns 2 / 80 = 2.50 percent. At a made-up fee of 0.1 percent per fill, the fees cost 0.001 x (80 + 82) = 0.162 per unit, so the net is (2 - 0.162) / 80 = 2.30 percent. The top grid buys at 118 and sells at 120. It earns 2 / 118 = 1.69 percent before fees and 1.49 percent after them. Equal price gaps mean unequal percent profits, which is the case for arithmetic spacing.
With the price at 100, the lines at 80, 82 and so on up to 98 are below it, which is 10 buy orders. The other 10 grids have their sells above the price. Those 10 buys hold $500 of the $1,000 as cash, waiting.
The warning the calculator gives
Grid bots are sold on the number of orders they fill. The number that matters is what each completed grid earns after costs. Squeeze the same range into 200 grids and the spacing falls to 0.20, which is 0.25 percent of 80 and 0.17 percent of 118. The round-trip fee at 0.1 percent per fill is about 0.2 percent. At the top of the range the net is below zero, and in the bottom grids it is only a few hundredths of a percent. A thousand fills a day would show activity and no profit. The calculator turns the result red when the net is zero or below on any grid.
Real conditions can make this worse. Exchanges set a minimum order size, and when the money per grid falls near that minimum, bots round the size, skip grids or refuse the setup. A small account spread across many grids hits the limit first.
What happens when price leaves the range
The grid has no opinion about direction. It sells rises and buys falls, and that is only profitable if price keeps coming back. Take the same made-up grid with all the buy lines filled on a slide below 80. The bot has spent the whole $1,000 and holds 10.24 units. Its average cost is 97.64. If price then sits at 80, the holding is worth 10.24 x 80 = $819.32, a result of -18.1 percent, with no cash left to buy more and no grid sells above the market until price climbs back to 82. Every grid that completed on the way down earned its small amount, and none of that offsets a slide of this size.
The reverse is a straight rise through the top. Every sell fills, the bot holds only cash, and it stays idle while price runs away above 120. It has banked the grid profits and missed the move.
Why the price range is the real decision
- A narrow range gives larger profits per grid for the same number of lines, but price leaves it sooner.
- A wide range keeps the bot working through bigger swings, but the investment is spread thinly and each grid earns less.
- More lines raise the fill count and cut profit per grid. The fee does not shrink with the gap.
- A futures grid adds leverage and a liquidation price. This page does not model it. See futures grid liquidation.
To see how a grid is built and why it behaves as it does, read how grid trading works. For the fee side in detail, read grid bot fees and costs.
Keep Going
Related Tools and Guides
Keep exploring
FAQ
Frequently Asked Questions
What is the difference between grid lines and grids?
Lines are the price levels, including the bottom and top. Grids are the gaps between them, so there is always one fewer grid than lines. Some bot screens ask for grids and some for lines, so check which yours uses before comparing.
Should I use arithmetic or geometric spacing?
Arithmetic keeps equal price gaps and suits a narrow range. Geometric keeps equal percent gaps and suits a wide range, where an equal price gap would be a much larger percent at the bottom than at the top. This is a design choice with a trade-off, not a recommendation.
Why does profit per grid fall toward the top with arithmetic spacing?
The gap is the same in price units, but the buy price is higher, so the same gap is a smaller percent of it. The bottom grid in the example earns 2.50 percent and the top 1.69 percent before fees.
Does the calculator include slippage, spread and funding?
No. It includes only the fee you enter on each fill. Resting orders usually avoid the spread, but a fast market can fill them worse than the line, and futures grids add funding. Treat the result as an upper limit.
What does it mean when the current price is outside my range?
The grid is idle. Below the range it has bought everything and holds the asset, above the range it has sold everything and holds cash. It starts working again only when price returns to the range.
Are the numbers on this page real?
Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.
Can I use this to decide whether to run a bot?
It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.
Is this financial advice?
No. It is a calculator and general education. It does not consider your situation, and its answers are only as good as the numbers you enter.
Know the Risk Before You Run It
Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.
Trading carries a risk of loss