# Fill Models, Partial Fills and Order Queues

> A fill model decides when and at what price backtest orders execute. Learn market, limit and stop fill assumptions, queue position and adverse selection.

Source: https://learn.tradelabsai.com/research/fill-models/  
Track: Research and Backtesting · Level: Advanced · Updated: 2026-10-03  
Publisher: TradeLabs AI (https://tradelabsai.com). Education, not financial advice.  
Cite as: TradeLabs Learn, "Fill Models, Partial Fills and Order Queues", https://learn.tradelabsai.com/research/fill-models/

A backtest must decide what happens when the strategy sends an order: does it fill, at what price and how much? These rules make up the fill model. Optimistic fill models are a hidden source of fake profits, especially for strategies that use limit orders, trade small moves or depend on precise entries. Realistic fill modelling matters most for short term strategies, where a tick or two per trade can be the entire edge.

## Fill assumptions by order type

| Order | Simple assumption | More realistic assumption |
|---|---|---|
| Market order | Fill at the next bar's open or last price | Fill at the ask (buy) or bid (sell), plus slippage scaled to size and volatility. See [Market Orders](https://learn.tradelabsai.com/orders/market-orders/) |
| Limit order | Fill if price touches the limit | Fill only if price trades through the limit, or after your queue position is reached. See [Limit Orders](https://learn.tradelabsai.com/orders/limit-orders/) |
| Stop order | Fill at the stop price | Fill at the next available price after the stop triggers, often worse in gaps. See [Stop Orders](https://learn.tradelabsai.com/orders/stop-orders/) |
| Stop limit | Fill at the limit | May not fill at all if price gaps past the limit. See [Stop-Limit Orders](https://learn.tradelabsai.com/orders/stop-limit-orders/) |

## The limit order problem

Limit orders look great in naive backtests: you buy at your price whenever it is touched. In reality:

- **Queue position:** other orders at the same price fill first. Price may touch your level without reaching your order. See [Fill Probability and Queue Position](https://learn.tradelabsai.com/orders/queue-position/).
- **Adverse selection:** your limit buys tend to fill when the price keeps falling, and miss when it bounces immediately. Filled orders are disproportionately the bad ones.

**Example: Touch vs trade through**
A mean reversion strategy places limit buys 2 ticks below the market. A "fill on touch" backtest shows a 62% win rate and strong profits. Changing to "fill only if price trades at least one tick through the limit" cuts fills by 40%, and the missed trades turn out to be mostly winners that bounced right at the limit. The win rate falls to 51% and profits disappear. The original result came from fills that would not have happened. See [Slippage](https://learn.tradelabsai.com/markets/slippage/).

## Partial fills and size

Large orders relative to available liquidity may fill only partly or move the price. A fill model can cap fills at a share of the volume traded in each bar, such as 5% to 10%, and apply market impact to larger orders. See [Market Impact](https://learn.tradelabsai.com/orders/market-impact/).

## Gaps and stops

Stops do not protect against gaps. If a stock closes at $50 and opens at $44 after bad news, a stop at $48 fills near $44. Backtests should fill stops at the first available price after the trigger, including gaps. See [Price Gaps and How to Trade Them](https://learn.tradelabsai.com/chart-patterns/price-gaps-and-how-to-trade-them/).

## Data resolution matters

| Data | Fill modelling quality |
|---|---|
| Daily bars | Only rough; intraday order of highs and lows unknown |
| Minute bars | Better; still ambiguous within each bar |
| Tick or trade data | Good for trade through tests |
| Order book data (Level 2 or 3) | Allows queue position modelling. See [Order Book Feeds: Snapshots and Incremental Updates](https://learn.tradelabsai.com/programming/order-book-feeds/) |

Ambiguous bars should be resolved conservatively, such as assuming the stop was hit before the target.

## A conservative default fill model

1. **Market orders:** fill at the next available price, crossing the spread, plus slippage.
2. **Limit orders:** fill only when price trades through by at least one tick, and cap size by volume.
3. **Stops:** fill at the next price after triggering, including gaps.
4. **Ambiguous bars:** assume the worse outcome.
5. **Compare with live fills** once trading and adjust. See [Slippage Analysis](https://learn.tradelabsai.com/orders/slippage-analysis/).

## Simulating with market replay

For high frequency strategies, firms replay historical order book data through a simulated exchange matching engine, modelling queue position and latency. This is the most realistic approach but requires detailed data and engineering. See [Market Data Replay](https://learn.tradelabsai.com/programming/market-data-replay/) and [Matching Engines](https://learn.tradelabsai.com/orders/matching-engines/).

## Frequently asked questions

### What is a fill model in backtesting?

The set of rules a backtest uses to decide whether orders execute, at what price and in what quantity.

### Why do limit orders look too good in backtests?

Because naive models fill them whenever price touches the limit, ignoring queue position and the tendency for limit orders to fill mainly before adverse moves.

### How should stop orders be filled in a backtest?

At the first available price after the stop is triggered, which can be much worse than the stop price when markets gap.

Next, learn to test many positions together in [Portfolio and Multi-Asset Backtesting](https://learn.tradelabsai.com/research/portfolio-backtesting/).

## Continue learning

- Next lesson: [Portfolio and Multi-Asset Backtesting](https://learn.tradelabsai.com/research/portfolio-backtesting/)
- Previous lesson: [Event-Driven vs Vectorized Backtesting](https://learn.tradelabsai.com/research/vectorized-backtesting/)
- Related: [Event-Driven vs Vectorized Backtesting](https://learn.tradelabsai.com/research/vectorized-backtesting/): Vectorised backtests compute signals and returns for all dates at once using arrays. Learn how they work, a pandas example, their speed advantages and their traps.
- Related: [Costs and Slippage in Backtests](https://learn.tradelabsai.com/research/costs-and-slippage-in-backtests/): Ignoring costs is the fastest way to fool yourself in a backtest. Learn the costs to include, how to estimate slippage and market impact, and conservative rules.
- Related: [Fill Probability and Queue Position](https://learn.tradelabsai.com/orders/queue-position/): Your place in the order queue decides whether a limit order fills. Learn how queues work, how to estimate fill probability and why fills can be a warning sign.
- Related: [Limit Orders](https://learn.tradelabsai.com/orders/limit-orders/): A limit order trades only at your price or better. Learn how buy and sell limits work, why they may not fill, queue priority and how to set a smart limit price.
- Related: [Slippage](https://learn.tradelabsai.com/markets/slippage/): Slippage is the gap between the price you expect and the price you get. Learn what causes it, how to measure it and the practical ways to reduce slippage.
- Related: [Market Data Replay](https://learn.tradelabsai.com/programming/market-data-replay/): Market data replay feeds recorded live data back through a trading system to test, debug and benchmark it. Learn how to record, replay and stay deterministic.
