One line of a backtest results table, "hold for the next period," carries a sentence that is not written down. It says the order was filled at that price, in the quantity wanted, without fail. Lesson 585 assumed the fill happened and computed its cost as one-way cost × turnover. This lesson looks at the question before that: could that quantity really have been filled at that price?
Backtests are optimistic about fills mainly in three places. They assume a fill right at the close used for the decision, a fill whenever the price merely touches a limit price, and a fill at the same price whatever the order size. We use hypothetical numbers to compute how much the result changes when each assumption is made conservative.
The meanings of spread and slippage were covered in Lesson 477, placing a breakout order as a stop-limit order in Lesson 277, and the execution of stop-loss orders and gaps in Lesson 284 and Lesson 285. Here we look only at how those orders are handled inside a backtest calculation. All prices and trades in this lesson are hypothetical and are not examples of any rule.
1. The assumption of deciding on the close and filling at the same close
A rule that decides by looking at the close finishes its decision only after the close is final. At that moment, trading at that close is no longer possible. The decision time and execution time separated in Lesson 583 become a problem again here.
There are two honest choices. One is to decide on the close and fill at the next period's open. The other is to decide on the price just before the market close and fill at the close with a market-on-close order. With the second, the price used for the decision is not the close but the price a few minutes before the close, and the backtest must be recomputed with that price. A calculation that fills at the close used for the decision mixes the decision of the first method with the fill of the second.
We compute the same two holding spells both ways.
| Spell (hypothetical) | Close used for the decision | Next period's open | Seen at the next open |
|---|---|---|---|
| Spell 1 start | 100.00 | 100.60 | Bought 0.60 higher |
| Spell 1 end | 108.00 | 107.40 | Sold 0.60 lower |
| Spell 2 start | 104.00 | 104.30 | Bought 0.30 higher |
| Spell 2 end | 101.00 | 101.50 | Sold 0.50 higher |
Filling at the close used for the decision, the return of spell 1 is 108 ÷ 100 − 1 = 8.00%, and the return of spell 2 is 101 ÷ 104 − 1 = −2.88%. At the next period's open, spell 1 is 107.40 ÷ 100.60 − 1 = 6.76%, and spell 2 is 101.50 ÷ 104.30 − 1 = −2.68%. Chaining the two spells, filling at the close gives 4.88% and filling at the next open gives 3.89%, a 0.99 percentage point difference.
The difference does not always go against you. Sometimes the next open is better, as at the end of spell 2. But do not assume the direction in advance. If the data has opens, recompute with the next period's open and write the two results side by side. If the data has no opens, record "fill price not confirmed" in the plan.
2. Touching a limit price is not the same as being filled
A buy limit order buys only at or below the set price. A common backtest calculation is this: if the period's low is at or below the limit price, fill at the limit price. But if the low merely touched the limit price, you cannot know whether your order was filled among the orders queued at that price (the queue order of Lesson 477).
The bigger problem is that fills and non-fills are not split at random. On a day when the price breaks through the limit and keeps falling, the order is almost certainly filled. On a day when the price barely touches the limit and rises right away, it is likely not filled. This tendency to be filled more often when the price moves against you is called adverse selection.
Assumptions: a buy limit order at 99 was touched in 10 periods with a low of 99 or below. In 4 of them the price broke below the limit, and the average return from the fill to the next period was −1.5%. In the other 6 the low stopped exactly at 99 and the price rose; buying at 99 would have given an average return of +2.0%.
| Fill assumption | Number filled | Average return per trade |
|---|---|---|
| All filled when touched (optimistic) | 10 | (4 × −1.5 + 6 × 2.0) ÷ 10 = 0.6% |
| Half of the 6 touch-only cases filled | 7 | (4 × −1.5 + 3 × 2.0) ÷ 7 = 0.0% |
| Filled only when the price broke through (conservative) | 4 | −1.5% |

For the same order and the same price record, one fill assumption moved the average per trade from 0.6% to −1.5%. The optimistic 0.6% is a number created by putting good trades that would not have been filled into the result. So a rule that uses limit orders is computed once more under a conservative assumption, at least something like "filled only when the price breaks the limit by one tick or more."
A stop-limit order placed for a breakout buy (Lesson 277) is the same with the direction reversed. If the price gaps open above the limit, the order is not filled, and that period may be exactly the one that rose sharply. If the backtest assumes a fill at the limit price in that period, the same adverse selection enters in the opposite direction.
3. Tradable size and participation rate
The participation rate is your order size divided by the dollar volume traded in that period. A backtest usually assumes that the whole order is filled in one period, whatever the account size. In reality, the higher the participation rate, the more your order pushes the price and worsens the fill price, and if it is too large it cannot be filled in one period at all.
Assumptions: a hypothetical asset with a daily dollar volume of $40 million and a participation cap of 5%. Then the most you can order in one period is $40 million × 5% = $2 million. To move a whole account of $5 million, $5 million ÷ $2 million = 2.5, so it must be split over three periods. The price moves in between, so the result differs from a backtest computed with the fill price of the first period alone.
Market impact uses the square-root approximation of Lesson 585 as it is. Assumptions: impact is 1.0% at a participation rate of 100%, and impact = 1.0% × √participation rate.
| Account size (hypothetical) | Participation rate | Impact of one fill (approximation) | Split at the 5% cap |
|---|---|---|---|
| $200,000 | 0.5% | about 0.07% | 1 period |
| $2 million | 5% | about 0.22% | 1 period |
| $20 million | 50% | about 0.71% | 10 periods, about 0.22% each |
Assuming a single fill, the impact cost of the same rule differs about tenfold between a $200,000 account and a $20 million account. Even split over ten periods, it is about 0.22% in each, about three times that of the small account, and the price also moves meanwhile. If you want to see the result at a larger size, recompute the costs for that size and include the price changes during the split fills. The trap of this lesson is using the costs of a small account for the result of a large one.
4. Handling trading halts, gaps and unfilled orders
Fill assumptions also include what to do when an order is not filled. In a trading halt there is no price and no order is filled. The first price after the halt ends can be very different, and if the backtest assumes a fill at the last price before the halt, that difference disappears.
Gaps are the same. Lesson 284 showed that a stop-loss order can be sold at the first traded price after a gap, not at the stop price, and Lesson 285 covered sizing positions to prepare for gaps around announcements. In a backtest, decide in advance on something like filling at the worse of the stop price and that period's open.
Write down the handling of unfilled orders as numbers too. Decide whether to resubmit on the same terms in the next period, switch to a market order or cancel, and whether to treat the return in the meantime as the cash return. If this line is empty, the order is handled however the calculation code decides, and usually it is computed as if it were filled without any problem.
5. Write a table of fill assumptions in the plan and compute twice
Fill assumptions get one box in the pre-registered plan of Lesson 581. Write the optimistic and conservative assumptions side by side, and state, before seeing results, that you will compute under both.
| Item | Optimistic assumption | Conservative assumption |
|---|---|---|
| Fill price | The close used for the decision | Next period's open |
| Limit orders | Filled when touched | Filled only if the price breaks through by one tick or more |
| Size | The whole account filled in one period | Participation cap; split fills above it |
| Halts, gaps, unfilled orders | Filled at the last price | The next first price; unfilled means cash |

If the two results are similar, the result does not lean much on the fill assumptions. If the result disappears under the conservative assumptions, it may have been made by the fill assumptions rather than the rule. Both numbers are only values computed on this data under these assumptions, and real fills differ again with the broker and market conditions.
The record for this lesson is the fill-assumption table. Write the optimistic and conservative assumptions for the four items, the participation cap and the dollar volume it is based on, and the results under both assumptions and their gap, with a date from before you see the results.
Try it yourself
- Under the assumptions of section 2, if only 2 of the 6 cases that merely touched the limit price are filled, what is the average return per trade?
- Assumptions: daily dollar volume $8 million, participation cap 2%. What is the largest order in one period, and how many periods are needed to move a whole account of $1 million?
- In the table of section 1, if the next period's open at the start of spell 2 had been 103.80 instead of 104.30, what is the return of spell 2 with fills at the next open?
- With the approximation of section 3, what is the market impact at a participation rate of 2%?
Answers
First, there are 4 + 2 = 6 fills, and the average is (4 × −1.5 + 2 × 2.0) ÷ 6 = about −0.33%. The lower the fill share of the touch-only cases, the closer the average comes to the −1.5% of the conservative assumption.
Second, $8 million × 2% = $160,000 is the largest order in one period. $1 million ÷ $160,000 = 6.25, so it must be split over seven periods.
Third, 101.50 ÷ 103.80 − 1 = about −2.22%. This time the next open is better than the close used for the decision, so the result is better than the −2.88% of filling at the close. That is why you do not assume a direction and compute with both prices.
Fourth, 1.0% × √0.02 = about 0.14%. That is about twice the roughly 0.07% at a participation rate of 0.5%, and less than the roughly 0.22% at 5%.
Related lessons
- Lesson 023. How do you use market, limit and stop orders?
- Lesson 274. Why the way you place an order changes your results
- Lesson 477. Why real-world results fall short of theory
- Lesson 277. Turning breakout entries into order rules
- Lesson 284. Executing a stop-loss signal as a real order
- Lesson 285. Preparing for earnings releases and gap losses
