Skip to content
All library documents

Grid Trading Parameter Search with Parallel Backtests

Code Stratmill research code

Summary

This document describes a parameter sweep for a grid trading backtest. It combines every configured symbol with candidate relative half-spread and grid-count values, then runs the resulting backtests in parallel over a selected date range. The grid interval is tied to the half-spread, while skew is calculated from the half-spread and grid count. Order quantity is estimated from a target dollar amount, rounded to the instrument’s lot size, and bounded by its minimum quantity; maximum position scales with grid count.

The document provides implementation details but no performance results or comparison of parameter choices. It cautions that expanding the search space can increase overfitting risk, and recommends limiting parameter selection carefully. Its outputs depend on the supplied ticker metadata, converted market data, latency files, and external backtest executable, so the script itself does not establish that a configuration is profitable or robust.

Key ideas

  • The script evaluates combinations of symbols, relative spread settings, and grid counts.
  • It runs separate backtests concurrently across a configured processor pool.
  • Grid interval and skew are derived from the half-spread and grid count to constrain the search space.
  • Order size is rounded to lot increments and constrained by the minimum quantity.
  • Expanding the parameter search may increase the risk of overfitting.

Tags

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