Skip to content
All library documents

Continuous Grid Trading with Replenishing Levels and a Stop-Loss

Article Strategy library · Author: pointalgo

Summary

This grid strategy divides a chosen price range into evenly spaced levels and assigns a fixed base-currency order size to each level. It activates once price closes inside the range. A level can open a long position when price moves down through it, provided that level is not already marked as holding; the position is closed when price subsequently moves up through the next level. After closing, that level becomes eligible to buy again, creating a replenishing grid.

The script allows up to 200 grid levels and includes an optional stop-loss price. If enabled and the close reaches or falls below that price, it cancels orders, closes positions, clears the level state, and deactivates the bot. The supplied code describes the mechanics but gives no backtest results or evidence of profitability. Grid performance depends on price staying within the selected range; sustained moves outside it, execution assumptions, fees, and the fixed order sizing can materially affect outcomes.

Key ideas

  • The bot divides a user-selected price interval into evenly spaced grid levels.
  • It buys at a level after a downward crossing if that level has no tracked position.
  • It closes that level's position after an upward move through the next grid line, then permits another entry.
  • An optional stop-loss closes all positions and resets the tracked grid state when its price condition is met.
  • The document provides no performance evidence, and the strategy depends on chosen range, execution, and cost assumptions.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.