Fills, slippage and fees in a futures backtest
Short answer
Fill every signal after it happens, at the next bar open or later. When a bar touches both the stop and the target, assume the stop came first. Charge slippage per side and the real commission, then run the test again with costs doubled. An edge that disappears is too thin to rely on.
Fill after the signal
A decision made at a bar’s close can only reach the market after that bar. Filling at the close that produced the signal is a form of lookahead, and it flatters every result.
Stop before target inside a bar
When one bar touches both the stop and the target, the bar cannot tell you which came first. Assume the stop did. This is the cautious choice, and it matters most for tight stops and targets on 1-minute bars.
Gaps go through stops
If the market opens past your stop, the fill is at the gap price, not at the stop. A stop is a minimum distance, not a cap on what a gap can cost.
Limit orders need a trade through
A limit order that is only touched may not have filled, because you may be at the back of the queue. Count it as filled only when price trades through the limit. A limit fill pays no slippage, but this rule removes the free fills that make limit strategies look too good.
Slippage and commission per side
Charge slippage on each side in ticks and add the real commission per contract. Both sides count: 1.5 ticks per side is 3 ticks for the round trip.
Pi(c) = sum over trades of (g_i - 2cv - f): gross result minus c ticks of slippage per side at tick value v, minus the fee.
| Contract | Tick | Tick value | 3 ticks, round trip |
|---|---|---|---|
| ES | 0.25 | $12.50 | $37.50 |
| MES | 0.25 | $1.25 | $3.75 |
| NQ | 0.25 | $5.00 | $15.00 |
| MNQ | 0.25 | $0.50 | $1.50 |
| GC | 0.10 | $10.00 | $30.00 |
| MGC | 0.10 | $1.00 | $3.00 |
Divide your average profit per trade by the tick value and compare. An idea that averages only a few ticks per contract before costs has little left after them.
Stress the costs
Live costs change with volatility and size, so a single cost assumption proves little. Run the same trades with fees and slippage doubled. A real edge gets smaller. A thin one disappears.
How BenchAlgo handles it
- The harness owns fills and costs. A strategy never sets a fill price, a fill time or a cost.
- Market and stop fills pay at least 1.5 ticks of slippage per side, plus a registered commission per contract. Limit fills pay no slippage but need a trade through the limit.
- The bar a position enters on can already stop out or hit the target, and stops must be at least 16 ticks away on the 1-minute tier.
- The Cost stress screen and the double-costs check show what happens when costs get worse.