The intuition: every trade has a toll
A backtest that ignores costs behaves as if you could trade for free, instantly, at the exact price your signal saw. Real markets do not work that way. Each time you buy or sell, you pay a small toll, and the more often you cross the toll gate, the more you pay.
This is why cost modelling is not a footnote. A strategy that trades once a year can ignore small frictions. A strategy that turns over its entire portfolio every week cannot. The gap between gross returns (before costs) and net returns (after costs) is often the difference between a promising idea and a dead one.
The categories of cost
Costs vary by market, instrument and broker, so treat every number below as an assumption to be replaced with figures you have checked yourself.
1. Commissions and fees
These are explicit charges: broker commissions, exchange fees, clearing fees and, in some markets, transaction levies or stamp duties. They are the easiest to model because they appear on a contract note. They may be a flat amount per trade, a percentage of value, or a per-share or per-contract rate.
2. Bid-ask spread
The spread is the gap between the best price a buyer will pay (bid) and the best price a seller will accept (ask). If you buy at the ask and later sell at the bid, you lose the spread on the round trip even if the "price" did not move. A backtest that trades at mid-prices or closing prices silently ignores this. See the bid-ask spread explained for the mechanics.
3. Slippage
Slippage is the difference between the price you expected when the signal fired and the price you actually got. It comes from delays, fast-moving markets and order type. Using market orders versus limit orders changes the trade-off: market orders are more certain to fill but tend to slip more; limit orders control price but may not fill.
4. Market impact
Market impact is the price movement caused by your own trading. Small orders in liquid assets barely register. Large orders relative to available volume push the price against you. Impact usually rises faster than linearly with order size, which is why turnover, liquidity and capacity limit how far a strategy can scale.
5. Financing and borrowing
If the strategy uses leverage, shorts stocks or holds futures positions, there are carrying costs: interest on borrowed cash, stock-borrow fees for short positions, and the roll cost when futures contracts are replaced. These accrue with time held, not just with the number of trades.
6. Taxes
Taxes depend heavily on jurisdiction, account type and holding period. Short-term gains may be taxed differently from long-term gains, and frequent trading can turn a tax-deferred position into a recurring tax event. Rates and rules change, so check the current official source for your country. See how investments are taxed for the general framework.
The mechanics: from cost per trade to cost drag
The core formula is simple:
Annual cost drag ≈ annual turnover × round-trip cost
Where:
- Turnover is the value traded per year divided by portfolio value. If you replace the whole portfolio once, a one-way turnover is 100%.
- Round-trip cost is the combined percentage cost of buying and then selling, including commission, half-spread on each side, slippage and impact.
A practical way to build the per-trade assumption is to add the components in percentage terms:
- Commission and fees per side
- Half the quoted spread per side
- Slippage allowance per side
- Impact allowance per side (often zero for small accounts in liquid assets)
Then apply it to every simulated trade, using the trade's value, rather than subtracting a flat percentage from the final result. Applying costs trade by trade lets the model charge more on days when the strategy trades heavily.
Worked example: a gross edge eroded by turnover
All numbers below are hypothetical and chosen for round arithmetic. They are illustrations, not forecasts.
Suppose a rules-based strategy shows a gross return of 8% a year in a backtest, on a portfolio of $100,000 (or ₹80 lakh at an illustrative rate; the percentages are what matter).
Assume these per-side costs:
| Component | Per side |
|---|---|
| Commission and fees | 0.05% |
| Half the bid-ask spread | 0.10% |
| Slippage allowance | 0.05% |
| Impact allowance | 0.00% |
| Total per side | 0.20% |
A round trip (buy plus sell) therefore costs 0.40% of the traded value.
Now see what happens at three different turnover levels. Here, turnover means the number of times the full portfolio is bought and sold in a year (one round trip per unit).
| Annual round trips | Cost drag (turnover × 0.40%) | Net return (8% gross) |
|---|---|---|
| 1 | 0.4% | 7.6% |
| 6 | 2.4% | 5.6% |
| 20 | 8.0% | 0.0% |
The signal did not change. The same 8% gross edge shrinks to 5.6% at six round trips and disappears entirely at twenty. In dollar terms on $100,000, twenty round trips means $8,000 a year in frictions, which equals the entire gross gain.
Now add financing. If the strategy also holds a short book costing an assumed 1% a year in borrow fees on half the portfolio, that is a further 0.5% drag on the whole portfolio. The six-round-trip strategy falls from 5.6% to roughly 5.1% before any tax. If gains are taxed at a hypothetical 20%, the after-tax figure falls further, to about 4.1% on the positive return. The pattern is the point: each layer takes a bite, and they compound against you.
Making the model more realistic
- Vary the spread by asset and period. Spreads typically widen in stressed markets and for less liquid assets. A single average understates costs when they matter most.
- Scale impact with size. If your order is a meaningful fraction of daily volume, use a larger impact allowance. Check liquidity and trading volume when setting limits such as a maximum percentage of average daily volume.
- Trade at realistic prices. If the signal uses the close, assume execution at the next open or a later price, not the same close. This also protects against look-ahead bias.
- Model both explicit and implicit costs. Commissions show up in statements; spread and slippage do not, so they must be estimated.
- Stress-test. Rerun the backtest with costs at 1.5 times and 2 times your estimate. If the result flips from profitable to unprofitable, the edge is fragile. This is one form of robustness testing.
Common mistakes
- Using zero costs "for now". Early results anchor expectations. Include a conservative cost from the first run.
- Using today's costs for the whole history. Commissions have generally fallen over time in many markets, while spreads and market structure have also changed. Costs from decades ago may differ materially from current ones.
- Charging costs on net changes only. If the strategy sells one position and buys another, both legs incur costs even if the total exposure barely changes.
- Ignoring capacity. Costs that look small at $10,000 may be large at $10 million because impact grows with size.
- Forgetting short-side and financing costs. Long-only cost assumptions do not carry over to leveraged or short strategies.
- Optimising parameters on gross returns. Tuning a rule to maximise pre-cost performance often selects high-turnover settings that fail after costs, which feeds overfitting.
- Treating one cost number as certain. It is an estimate. Use a range.
Try this
Take any simple rule-based backtest you have, or a spreadsheet of hypothetical trades, and do the following:
- Choose a gross annual return of 6%.
- Set a per-side cost of 0.15% (an assumption; use a figure realistic for your market if you know it).
- Calculate net returns for 2, 10 and 25 round trips per year.
- Find the number of round trips at which net return reaches zero.
- Double the per-side cost and repeat. Note how much the break-even turnover falls.
Write down what the exercise suggests about how much trading your edge can afford. This is the idea behind a cost budget: the edge sets the maximum turnover, not the other way round.