Skip to content
All library documents

Directional Grid Trading with Price Spacing and Cover Thresholds

Article Strategy library · Author: 发明者量化-小小梦

Summary

This tutorial outlines a directional grid that adds a position whenever the market moves beyond the next grid level by a configured spacing. In upward mode it sells at successive levels and later buys back when price reaches a cover threshold; downward mode buys and later sells. Each grid node records its level, filled amount, and cover price. The parameters control direction, node count, order size, spacing, and the price difference used to close a node.

The loop checks ticker prices and updates the grid repeatedly, closing the newest node when its cover condition is met. If the number of open nodes exceeds the configured limit, it closes the oldest node and increments a stop-loss counter. This is a compact implementation example rather than a tested performance study: it reports no market, backtest, or cost results. Its behavior depends on execution prices and fees, and the node-limit closure can realize a loss without an overall portfolio stop or broader exposure controls.

Key ideas

  • The grid adds nodes as price advances by the configured spacing in the selected direction.
  • Each node stores its entry details and a cover price for closing the position.
  • The system closes the newest node after its cover condition is reached.
  • When the grid exceeds its node limit, the oldest position is closed and counted as a stop loss.
  • The example gives no performance evidence and does not describe portfolio-level risk controls.

Tags

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