Self-Trade Prevention in Simulation
Why a realistic backtest of multiple strategies sharing one account must model the exchange rule that stops a firm's own orders from trading against each other, or risk badly overstating fill rates and liquidity.
Exchanges generally forbid, or actively prevent, a single firm's own orders from matching against each other — a rule called self-trade prevention (STP). When a firm's buy order and sell order would otherwise cross at the same price, the exchange's matching engine cancels or reprices one of them rather than letting the trade execute, since a firm trading with itself creates no economic risk transfer and can be used to manipulate reported volume or manipulate other participants' view of liquidity.
A backtest that simulates several of a firm's own strategies trading in the same instrument, without modeling STP, will let those strategies fill against each other in the simulation — fills that would never actually happen on the real exchange. This overstates both strategies' fill rates and can make a portfolio of strategies look like it has more available liquidity, and less competition for fills, than it really would in production.
Worked example
Two independent strategies in the same firm both trade a stock: one is buying at $50.02, the other selling at $50.02, at the same moment. In a backtest without STP modeling, these fill against each other for the full size, showing both strategies executing cleanly. On the real exchange, self-trade prevention would cancel or reprice one of the orders, and each strategy would instead have had to fill against genuine outside liquidity — likely at a worse price or not at all. A simulator ignoring STP would have shown a materially rosier combined P&L than production would actually deliver.
Self-trade prevention stops a firm's own orders from matching against each other on the exchange, and a backtest running multiple of a firm's strategies together must replicate that rule explicitly — otherwise the simulation lets strategies trade with themselves for fills that could never happen in reality, overstating both liquidity and P&L.
Related concepts
Further reading
- Harris, Trading and Exchanges, ch. 4