Transaction Cost Modelling Inside a Backtest

A backtest without a cost model reports gross returns, and the arithmetic of commission, spread, and impact usually erases most of a strategy's edge.

Transaction cost modelling inside a backtest means charging every simulated trade the commission, bid ask spread, and market impact it would actually incur, rather than assuming the fill happens at the quoted price for free. A strategy's reported Sharpe ratio before costs and its Sharpe ratio after costs are frequently different numbers by a factor of two or more, and the gap between them is the single most important figure a portfolio manager asks for before allocating capital.

Commission is the fee paid to a broker or exchange per share or per contract and is the easiest component to model, since it is usually a fixed, published rate. Bid ask spread is the cost of crossing from the best bid to the best offer, or vice versa, to get a fill immediately rather than waiting, and it varies by instrument and by time of day, widening around the open, the close, and scheduled economic releases. Market impact is the cost of the trade itself moving the price against the trader, which grows with order size relative to the liquidity available at that moment and is the hardest of the three to estimate without a live execution record.

A backtest that models only commission and ignores spread and impact will overstate net returns for any strategy that trades with meaningful size or frequency, since commission is typically the smallest of the three costs for anything beyond a small retail account.

Consider a strategy showing an average edge of 4 basis points per trade in a backtest that assumes no transaction costs. Round trip cost, meaning the combined cost of entering and later closing the position, runs about 3 basis points once commission, spread, and impact are included. The net edge after costs is 1 basis point per trade, one quarter of the figure the cost free backtest reported.

Because the Sharpe ratio is the mean return divided by the standard deviation of returns, and transaction costs reduce the mean far more than they change the standard deviation, a backtested Sharpe ratio of 2.0 computed on the gross 4 basis point edge falls to approximately 0.5 once the same volatility is measured against a mean return that is one quarter the size. A strategy presented with a Sharpe ratio of 2.0 and no cost model attached is effectively presenting a figure four times larger than what a desk would actually earn trading it. The full mechanics of how spread and impact combine are worked through in Slippage, Execution Costs, and Market Impact.