Guide · 3 min read
Partial fills
In the Strategy Tester, an order either fills completely or not at all. In a live account, a 2-contract limit order can fill 1 contract and leave the other waiting. Then the live trade is smaller than the tester's, and the P&L gap is partly about size, not price.
How the tester fills an order
TradingView's broker emulator fills the whole order once price gets there. For a limit order, its documentation says the order fills when the market price reaches the limit, or crosses it in the favourable direction, at that price or better.
The backtest_fill_limits_assumption argument of strategy() changes that. It's the number of ticks price has to move beyond the limit before the emulator counts a fill. The default is 0, so a touch is enough.
How a live order fills
- Limit orders wait in a queue. Price touching your level doesn't mean your order reached the front of the queue. When price touches and turns away, the order can fill partly, or not at all.
- Market orders on liquid futures usually fill in full, sometimes as several executions at different prices.
- What happens to the rest depends on the order and the bridge: the remainder may stay working, be cancelled by the strategy's next order, or expire at the end of the session.
Split fill or partial fill?
They look alike in a broker file and mean different things.
| Split fill | Partial fill | |
|---|---|---|
| What happened | One order filled in full, as two or more executions | The order filled less than its size |
| Example, tester size 2 | 1 at 21,000.25 and 1 at 21,000.50, same order ID | 1 at 21,000.25, nothing more |
| In the report | One entry at the size-weighted average price, labelled as usual (Matched, Late exit…) | Labelled Partial fill, with a note such as Filled 1 of 2 |
The report groups executions by order ID when the broker file has one (most fill and order exports do, including IBKR Flex, Tradovate, NinjaTrader Executions, ProjectX and Rithmic), so a split fill is one entry, not a duplicate.
What a partial fill does to the numbers
Take a tester trade of 2 MNQ long that gains 20 points. MNQ is $2 a point, so the tester shows $80. Live, 1 contract fills, at exactly the tester's prices:
| Tester: 2 contracts × 20 points × $2 | $80 |
| Live: 1 contract × 20 points × $2 | $40 |
| Gap (live − tester) | −$40 |
| Price slippage | 0 ticks |
The whole gap is the missing contract. A partial fill on a losing trade does the opposite: the live loss is smaller, and the gap looks like an improvement. That's why the report keeps the two apart.
- Slippage in ticks is per fill and doesn't depend on size. Slippage in dollars is multiplied by the quantity that actually filled.
- Live P&L uses the smaller of the entry and exit quantities. Tester P&L is the tester's full size. The trade-by-trade gap includes the difference.
- Partial fills are counted in the paired trades the statistics cover, so they're in the live-vs-tester gap. The report's summary says how many trades filled only partly.
Then the exit
If the entry filled 1 of 2 and the exit order is sent for the tester's full 2, the exit is larger than the position. Depending on the bridge and broker, the extra contract may be rejected, or may open a position in the other direction. The report adds a note when the sizes differ, such as Exit size 2 differs from entry size 1. An unintended opposite position closed later shows up as orphan fills: fills with no tester trade near them.
Seeing how much the tester leans on touch fills
Partial and missed fills tend to cluster where a limit order sits at the very edge of a move, the bar's high or low. One way to measure how much of a backtest depends on those fills: set backtest_fill_limits_assumption to 1 or 2 ticks, run the tester again, and compare the two List of trades exports. Trades that vanish are the ones that needed price to just touch the level.
Trade Teardown labels each partial fill, shows how much filled against the tester's size, and keeps size apart from price slippage, with the source line from both files, in your browser.