A Compact Grid Strategy with Price Spacing and Position Limits
Summary
The document presents a shortened implementation of a grid trading strategy and explains that it condenses a much longer earlier version. The strategy tracks grid levels in a list. As price moves far enough in a chosen direction, it opens a position at the next grid spacing and records a cover price. When price reaches that cover level, it closes the latest position. If the grid grows beyond a configured maximum number of levels, it closes the oldest position instead. The program also records trades and displays account and grid status.
The example shows the mechanics of level creation, position closure, and a cap on open grid entries. It does not define the grid spacing, trade amount, direction, or other configuration values, and it provides no backtest or live performance evidence. The forced closure of the oldest level is labeled as a loss counter, but the document gives no risk analysis, fee or slippage treatment, or market assumptions. The code illustrates structure rather than demonstrating profitability.
Key ideas
- The strategy adds grid levels when price movement exceeds a configured spacing.
- Each level stores its entry information and a price at which it can be covered.
- The newest position is closed when price reaches its cover threshold.
- When the grid exceeds its configured level limit, the oldest position is closed.
- The document describes implementation mechanics but supplies no performance evidence.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.