Order-Flow Backtesting for High-Frequency and Grid Strategies
Summary
The document explains why candle-based backtests can mislead, especially for high-frequency and multi-instrument strategies. Candles omit the timing of trades and bid-ask quotes, making it hard to reconstruct simultaneous prices or realistic fills. They also cannot reproduce price-time queue priority, while strategies with large orders may affect market prices and other participants’ fills. Tick-level replay with depth data can improve timing and matching detail, but it requires large datasets, runs slowly, and still does not capture a strategy’s full market impact.
The proposed alternative uses chronological trade prints and their aggressor side to infer the best bid and ask, then simulates orders against later prints. The rules distinguish maker and taker fills, price priority, partial fills, fees, and order timing. A grid strategy on a perpetual contract illustrates how the method can model order size and sleep interval effects. The results show lower relative returns as order size grows, and a modest change with a shorter interval. The approach remains an approximation: queue position and fill probability at equal prices are omitted, and historical order flow cannot fully reveal counterfactual market impact.
Key ideas
- Candle data hides trade timing and quote conditions, limiting the accuracy of high-frequency and multi-asset backtests.
- Trade prints with aggressor direction can be used to approximate the best bid and ask over time.
- The proposed matching rules simulate maker and taker fills, price priority, partial execution, fees, and strategy timing.
- The grid example shows that modeled relative returns decline as order size grows, reflecting capacity constraints.
- The method remains approximate because queue priority, equal-price fill probability, and full market impact are not captured.
Tags
Cited by
- Strategies Hummingbot PMMSimpleController (by hummingbot, Apache-2.0) faithful port: 2+2-level symmetric pure market making on WLDUSDT.BINANCE 1m, 1%/2% spreads around mid, per-level triple-barrier executors (SL 3%, limit TP 2%, 45-min time limit, 1.5%/0.3% trailing stop), 5-min refresh, 15-s cooldown, 20x
- Strategies Nearness-to-Range-Extreme Anchoring Momentum on XLMUSDT.BINANCE USD-M — Long-Short, Ungated, Pure Daily OHLCV: Hold ONLY While Price Sits in the Top/Bottom Decile of Its Trailing 180-Day Range, Flat Through the Whole Mid-Range
- Hypotheses SOL Daily Volume-Surge-On-Pullback Accumulation Entry Long-Only (BINANCE USD-M Futures, 1-DAY, OHLCV-Only, Smart-Money-During-Dip Mechanism)
- Hypotheses Nearness-to-Range-Extreme Anchoring Momentum on XLMUSDT.BINANCE USD-M — Long-Short, Ungated, Pure Daily OHLCV: Hold ONLY While Price Sits in the Top/Bottom Decile of Its Trailing 180-Day Range, Flat Through the Whole Mid-Range
- Hypotheses Hummingbot PMMSimpleController (by hummingbot, Apache-2.0) faithful port: 2+2-level symmetric pure market making on WLDUSDT.BINANCE 1m, 1%/2% spreads around mid, per-level triple-barrier executors (SL 3%, limit TP 2%, 45-min time limit, 1.5%/0.3% trailing stop), 5-min refresh, 15-s cooldown, 20x
- Hypotheses HYPE Native Spot Demand Shock, Perpetual Follow-Through
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.