DNS Research

Understanding Slippage and Fees in Backtesting

advertisement

Understanding Slippage and Fees in Backtesting

Backtesting is the process of applying a trading strategy to historical market data to estimate how it would have performed. The reliability of that estimate depends almost entirely on how faithfully the simulation reproduces real trading conditions. Two of the most frequently underestimated factors in that reproduction are slippage and fees. Ignoring them, or modeling them crudely, produces equity curves that look impressive on paper but collapse under live execution. This article examines both costs in detail, explains how they distort backtest results, and outlines practical methods for modeling them accurately.

Why Transaction Costs Determine Strategy Viability

Every trade incurs frictions that reduce net returns: commissions, bid-ask spreads, slippage, exchange fees, financing costs, and taxes. A strategy that trades frequently can see its gross edge consumed entirely by these costs. Consider a high-frequency system generating a gross return of 0.05% per trade. If round-trip costs amount to 0.04%, the net edge is 0.01%—a rounding error that any minor execution shortfall will erase. Backtests that assume zero costs systematically overstate performance, inflate the Sharpe ratio, and understate drawdowns, because losing trades are understated in magnitude while winning trades are overstated.

The problem compounds with turnover. Costs scale linearly with the number of trades, while strategy edges often do not. A backtest that ignores costs will favor high-turnover strategies disproportionately, misleading researchers toward designs that cannot survive live conditions. Accurate cost modeling is therefore not a refinement—it is a prerequisite for any conclusion drawn from historical simulation.

Defining Slippage Precisely

Slippage is the difference between the price at which a trade was expected to execute and the price at which it actually executes. In backtesting, the “expected” price is typically the last traded price, the close, or the midpoint of the quoted spread at the moment the signal fires. In live markets, execution occurs at whatever price the order book permits, and that price is often worse.

Slippage arises from several distinct mechanisms. Bid-ask spread crossing is the most basic: a market buy order fills at the ask, not the mid, immediately creating a cost equal to half the spread. Market impact occurs when an order consumes liquidity, walking the book and filling at progressively worse levels. Latency slippage occurs because the price observed when the decision was made is not the price available when the order arrives at the exchange. Adverse selection describes the tendency of resting limit orders to fill precisely when the market is moving against the trader. Volatility amplifies all of these effects, which is why slippage is materially worse during news events, market opens, and periods of stress.

Modeling Slippage in a Backtest

There are several tiers of slippage modeling, each appropriate to different research stages.

Fixed slippage applies a constant cost per trade, such as 0.05% of notional or a fixed number of ticks. It is simple and transparent but ignores the relationship between slippage and order size, volatility, and liquidity. It is acceptable only for coarse screening.

Spread-based modeling fills market orders at the bid or ask rather than the midpoint, using historical spread data where available. This captures the most predictable component of execution cost and is the minimum standard for credible equity and futures backtests.

Volume-dependent modeling estimates market impact as a function of order size relative to available volume. A common approach is a square-root impact model, in which expected slippage scales with the square root of (order size / average daily volume). This reflects the empirical regularity that impact grows sublinearly with size and is widely used in institutional research.

Volatility-adjusted modeling scales slippage with realized volatility or the average true range at the time of the trade, recognizing that execution costs rise when markets move quickly.

Full order-book simulation replays limit order book data tick by tick, filling orders according to queue position and available liquidity. This is the most accurate method and the most data-intensive; it is standard for high-frequency research and largely inaccessible to retail backtesters.

Whichever method is chosen, slippage should be applied asymmetrically and realistically: buys fill above the reference price, sells below it. A useful validation technique is to compare modeled slippage against actual execution data from a paper-trading or small live pilot period, then calibrate parameters accordingly.

Anatomy of Trading Fees

Fees fall into several categories that must be modeled separately. Commissions are broker charges per trade, share, or contract, and may be tiered by volume. Exchange and regulatory fees are levied per transaction and vary by venue and jurisdiction. Bid-ask spread costs, discussed above, are economically a fee even when no explicit charge is levied. Financing costs apply to leveraged positions: margin interest on borrowed funds, overnight swap rates in foreign exchange, and stock borrow fees for short sales. Taxes—such as stamp duty in some markets or short-term capital gains treatment—can materially alter net returns for active strategies. Finally, there are implicit costs such as fees embedded in fund structures, custody charges, and currency conversion spreads for cross-border trading.

Modeling Fees Accurately

Fee modeling should mirror the actual fee schedule of the intended broker and venue, not a generic assumption. Commission structures differ meaningfully: per-share pricing penalizes low-priced stocks, per-trade pricing penalizes small orders, and percentage-of-notional pricing penalizes large ones. Futures contracts carry exchange and clearing fees per contract that must be applied to both entry and exit. Foreign exchange strategies must account for spread costs embedded in quotes rather than commissions.

Financing costs deserve particular attention because they accrue continuously rather than per trade. A leveraged strategy held over many days accumulates margin interest that a per-trade fee model will never capture. Short positions in equities incur borrow fees that can spike dramatically during squeezes. Backtests of multi-day strategies that omit financing assumptions will overstate returns in proportion to leverage and holding period.

Taxes are frequently ignored in backtesting, which is defensible for strategy research but dangerous for net-of-tax evaluation. Where relevant, apply jurisdiction-specific rates to realized gains, accounting for holding-period distinctions between short- and long-term treatment.

The Interaction Between Slippage, Fees, and Strategy Design

Costs are not merely a drag on returns; they reshape which strategies survive. Mean-reversion strategies typically trade frequently and hold briefly, making them highly sensitive to per-trade costs. Trend-following strategies trade less often but may suffer larger slippage per trade because they often enter during momentum bursts when liquidity is thin. Market-making strategies earn the spread but bear adverse selection; their backtests are meaningless unless fills are modeled with queue position and realistic toxicity assumptions.

Cost modeling also exposes capacity constraints. A strategy that performs well at small size may degrade as order sizes grow and market impact rises. Backtests that hold position sizing constant while ignoring impact will overstate the scalable capacity of the strategy. Researchers should conduct sensitivity analysis, varying cost assumptions across a plausible range, and report performance under conservative, moderate, and optimistic cost scenarios rather than a single point estimate.

Common Pitfalls and Best Practices

Several errors recur in cost modeling. Assuming fills at the closing price on the signal day ignores that the close is often the least liquid moment and that the signal itself may be computed from data unavailable until after the close. Using midpoint fills for market orders understates costs systematically. Applying a single average slippage figure across all market conditions ignores the volatility and liquidity dependence of execution costs. Failing to model partial fills overstates achievable position sizes. And omitting financing costs entirely is common in equity backtests despite its material impact on leveraged and short strategies.

Best practice involves sourcing fee schedules from the actual intended broker, using historical spread and volume data where available, calibrating slippage parameters against live or paper-trading results, stress-testing performance across cost assumptions, and reporting results net of all costs. Results should be presented with turnover statistics so readers can judge cost sensitivity directly. Where cost data are uncertain, conservative assumptions are preferable: a strategy that survives pessimistic costs is more likely to survive live trading.

Conclusion-Free Synthesis of Method

Treat slippage and fees as first-class parameters of the backtest, not afterthoughts applied at the end. Document every cost assumption, justify each parameter with data or a stated rationale, and test sensitivity to each. A backtest is a hypothesis about future performance, and transaction costs are among the most reliably predictable features of that future. Modeling them rigorously transforms a backtest from an optimistic illustration into a decision-grade tool—one that filters out strategies destined to fail on contact with real markets and concentrates research effort on designs with genuine, cost-resilient edge.

advertisement

latest posts

Something went wrong. Please refresh the page and/or try again.