A rung fills the moment live price reaches it
Every rung is a limit order held in your paper account. When the exchange's live price trades at or through a buy rung, that rung fills in full at its own price. A sell rung fills the same way on the way up. Each fill is charged the exchange's maker rate, because a resting limit order is the maker side of a trade.
This is the main place a paper grid is kinder than a live one. On a real order book your order waits in a queue behind others at the same price, and price can touch a level and turn away before your turn comes. A paper rung never queues and never fills in parts. Expect a grid tested here to show more fills at its outer rungs than the same ladder would get on an exchange.
Arithmetic or geometric spacing, 2 to 180 levels
Arithmetic spacing leaves the same amount of money between each rung. Geometric spacing leaves the same percentage between them, so the gaps widen as price rises. Over a wide range the same inputs produce two noticeably different ladders.
The level count runs from 2 to 180. The capital you give the grid is split across its levels, so every rung you add makes each one smaller. The fee is a percentage of each fill, so a smaller rung pays the same rate as a large one. A dense ladder with tight spacing can hand much of each price swing to fees, and the paper ledger shows that because every simulated fill is charged.
Take-profit and stop-loss are absolute prices, and either closes everything
Both are entered as prices, in the same unit as the range bounds, rather than as percentages away from an entry. Touching either one cancels every resting rung, sells the coins the ladder holds at the live price, and files the run in your history with the rule that fired. That closing sale is a market order, so it pays the taker rate.
On every price update the exit check runs before the trailing check. If price jumps straight through the stop, the grid must not shift its ladder and commit more paper cash on the way past. Both rules also stay armed while the grid is paused, because a paused grid is still holding coins.
Trailing moves the ladder, and says so when it cannot
Trail-up and trail-down are independent switches. When price leaves the range in an enabled direction, the rung furthest from price is moved round to the near side rather than the grid being rebuilt. The moved rung always lands on its own side of the market, a sell above price and a buy below it, so it rests instead of filling on the very next update.
A sell ladder that has filled every one of its orders has no coins left to move. Rather than quietly closing the grid, the bot stops trailing, keeps the buy orders that are its only route back to holding coins, and shows the reason on the bot's card in the dashboard. It closes the grid only when nothing at all is resting, because at that point there is no way back.