Backtesting and Tuning a Perpetual Futures Grid Strategy
Summary
The article presents a Python workflow for evaluating a perpetual futures grid strategy: collect historical candles, model account balances, fees, positions and unrealized profit, then simulate grid orders. Its example uses DYDX data and examines how the initial reference price, grid spacing and trade value affect results. The grid logic buys as price falls and sells as it rises, while the backtest records profit, position size and fees.
The examples illustrate how choosing a different initial price can change both ending performance and exposure, and how narrower spacing can increase trading frequency and fees. The author cautions that each five-minute candle can trigger at most one buy and one sell in this simulation, which poorly represents intrabar order flow and makes fine-spacing results unreliable. Reported outcomes are specific to the chosen market, period and assumptions, not evidence of future returns. The article also highlights liquidation and potentially asymmetric risks from short exposure, recommending careful sizing and market selection.
Key ideas
- A grid simulation needs assumptions for fees, position accounting and order fills as well as price data.
- The starting reference price changes initial exposure and can materially affect reported performance.
- Grid spacing affects trade frequency, fees and accumulated position risk.
- A candle-based backtest that allows few fills per bar may misrepresent fast markets and tight grids.
- Perpetual grid results from one asset and sample period do not establish future profitability.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.