Skip to main content

StepGrid Strategy: Fee-aware Grid Trading in Spot Markets

· 5 min read
@boekenbox

Symbol image stepgrid

StepGrid: Turning Volatility Into Structured, Fee-Aware Profits​

Grid bots have been around for years, but most of them share the same weakness: they buy and sell at fixed price intervals without caring about the actual cost of the position that is building underneath. When the market comes back up, a classic grid may close parts of its bag at a loss because the bot never looks at fees or at how many units remain.

StepGrid was designed to fix that flaw. It keeps a running “unit cost” line that represents a full-position break-even, including trading fees, and it refuses to hit the market below that line unless a slice of the position can be closed at a genuine profit. In practice, this small upgrade changes the entire character of a grid. Profits are harvested earlier, losing partials disappear, and the trader gains a predictable exit—even when the grid has stacked twenty or forty buys during a deep drawdown.

How StepGrid Thinks About a Trade​

The moment StepGrid fires its first buy, it stamps that execution price as a reference. From there it watches both directions:

  • Downward: Each time price falls by one grid step, the bot checks that it still has room under MAX_BUY_COUNT. If so, it spends another TRADING_LIMIT.
  • Upward: When price rises by one grid step, the bot arms a trailing sell. If the trailer finishes above the calculated unit-cost line, the bot can unload part or all of the bag.

Because unit cost is recalculated after every fill, the break-even line keeps sliding lower while the position deepens. Eventually the market will revisit that line. When it does, StepGrid has two options. If the move is sharp and a full close is cheaper than fees, it sells everything. If the move is hesitant, it can sell a fraction—provided PROTECT_PARTIAL_SELL confirms that the slice alone is green.

Choosing a Step Size​

Most users leave AUTO_STEP_SIZE set to true. The bot then measures Average True Range over the last ATR_PERIOD candles, multiplies it by 1.5, and compares the result with two times the fee percentage. The larger of those two values becomes today’s step. The advantage is obvious: when volatility expands, StepGrid widens its ladder. When the market goes quiet, steps tighten and more trades fire.

Manual spacing still has its place. Event traders often disable auto stepping, enter a STEP_SIZE that matches the expected headline move, and turn ENFORCE_STEP on. Enforcement forces every buy and sell to respect those exact levels, which keeps position size predictable in news-driven spikes.

Position Sizing and Capital Risk​

Grid strategies live or die on exposure management. StepGrid makes that explicit by linking three parameters:

  1. TRADING_LIMIT – the capital per buy.
  2. MAX_BUY_COUNT – the maximum number of buys.
  3. KEEP_QUOTE – the amount of quote the bot must leave untouched for fees or withdrawals.

Multiply the first two and you know the worst-case bag size. That figure should sit well below your total account—ten to twenty percent is a common ceiling. Raise MAX_BUY_COUNT because you fear a long winter and you must lower TRADING_LIMIT to keep risk constant. The math never changes.

A Typical Cycle in Practice​

Consider a trader who runs USDT-BTC with a two-thousand-USDT account, a TRADING_LIMIT of 1000 USDT, and MAX_BUY_COUNT set to twenty.

  • Phase one: The market dips five percent. StepGrid logs three buys, each at a fresh low. Unit cost has moved down with the bag and now sits roughly two percent under the first order.
  • Phase two: Price finds a floor, drifts sideways, then rallies. As soon as it has climbed a full step, the bot arms a trailing sell. Volatility is still high, so the step is wide; the trailer finishes well above fees.
  • Phase three: The trailing stop hits and closes one-third of the position—an amount chosen automatically by the bot because the bag is already in profit territory.
  • Phase four: Unit cost recalculates. With fewer coins left, it rises a little. Price pushes higher again and this time the bot sees that a full exit at break-even plus fees is within reach. It sells the rest. The cycle ends green and resets.

During that entire sequence the trader never touched a button. The only manual decision was where to put TRADING_LIMIT and MAX_BUY_COUNT on day one.

When to Change the Defaults​

Most StepGrid setups work out-of-the-box, but three scenarios often require tweaks:

  • Extremely tight spreads with maker rebates: Lower MIN_VOLUME_TO_SELL so the bot can realize tiny gains without tripping exchange minimums.
  • Illiquid altcoins: Turn ENFORCE_STEP on. This reduces the chance that a thin order book drags a trailer into a worse-than-step fill.
  • Long-term accumulation: Disable SELL_ENABLED or enable FOREVER_BAGS. StepGrid will buy dips forever and never calculate a full exit, effectively dollar-cost averaging with grid precision.

Backtesting: Proof Before Money​

Gunbot Pro owners can replay trades with BF_SINCE and BF_UNTIL. Deep testing builds tick-level candles so StepGrid behaves as if it were live. Two passes—one in a trending month, one in a ranging month—are enough to check whether your parameters keep drawdown inside plan and still let the bot exit profitably. If the backtest shows prolonged underwater periods or too many skipped sells, the first levers to pull are wider step size and a lower maximum buy count.

Final Thoughts​

StepGrid will not outperform every strategy in every market. No robot does. What it offers is transparency and predictability: you always know your worst-case size, your dynamic break-even, and the exact rules that fire each order. That clarity is rare in grid trading and it frees the operator to focus on the higher-level decision—picking the pairs and deciding how much capital to commit. Get those calls right and StepGrid will handle the rest, one step at a time.