Skip to content
CONTENTS
Press a letter to jump to a section

Trading costs and slippage: when a profitable backtest stops working

Published 5 min readBacktesting and strategy evaluation:Part 1Part 2Part 3Part 4Part 5

A trading rule earns 1.13% on our synthetic sample before costs. Charge 5 basis points on each traded dollar, and its account loses 7.49%.

The rule, prices and signal timestamps are unchanged. The economic calculation is different because trading consumes cash and reduces the capital available for later positions.

This article separates the costs, shows where they belong in the ledger, and explains why subtracting one guessed percentage from the final return is not the same experiment.

Start with a traded dollar

One basis point is 0.01%, or 0.0001 as a decimal. A 5 bp charge on 10,000oftradednotionalcosts10,000 of traded notional costs 5. Buying and later selling approximately 10,000eachproducesapproximately10,000 each produces approximately 10 of costs.

Write “one-way” or “round-trip” beside every quoted rate. Confusing them can double or halve the intended charge.

For an order whose absolute traded notional is N, a simple proportional model is:

K=cN.K=cN.

This is the model used in our teaching ledger. The 5 bp rate is an assumption, rather than an estimate from observed fills.

One-way traded notional is charged on both entry and exit
One-way traded notional is charged on both entry and exit
At 5 bp, a 10,000purchasecosts10,000 purchase costs 5 and a separate 10,000salecostsanother10,000 sale costs another 5.

Four quantities often mixed together

Commission and venue fees are explicit charges. Their schedule can depend on the instrument, venue, account and liquidity-taking behaviour.
Spread cost arises when a buyer pays above a reference midpoint or a seller receives below it. If the spread is four cents and you buy then sell around an unchanged midpoint, the pair loses four cents per share before other charges.
Slippage is the difference between a specified reference price and the realised fill. Define the reference and sign convention. Slippage against the decision midpoint includes effects that slippage against the arrival ask may already exclude.
Market impact concerns how trading itself changes prices. Historical replay normally assumes your hypothetical order did not change the recorded path. That can be a poor assumption for larger or more urgent orders.

These quantities overlap depending on definitions. If an implementation-shortfall estimate already measures the fill against the decision midpoint, adding a separate spread penalty may double-count part of the same execution loss.

Our scalar cost rate bundles execution friction into a deliberately simple penalty. It does not identify commissions, spread, delay and impact individually.

The cash account makes the timing visible

On entry, the strategy spends money on shares and on the entry charge. It therefore buys fewer shares than the frictionless strategy. On exit, the sale produces cash less the exit charge.

Those differences affect subsequent position sizes. Compare two accounts running the same binary signal sequence: the one with higher costs generally brings less capital to future entries in this model.

That is why our final wealth difference is not equal to the sum of the cost account from only one run. Removing costs also changes later holdings and their gains or losses.

In the baseline synthetic run, explicit costs sum to 7,292.03.Thedifferencebetweenthezero−costand5bpterminalaccountsis7,292.03. The difference between the zero-cost and 5 bp terminal accounts is 8,611.28. The remaining difference comes from the different capital paths and resulting position sizes.

Both figures are useful. The first answers how many dollars the baseline account paid in explicit charges. The second compares two complete capital trajectories.

Count turnover with a convention

We define each session's one-way turnover as the absolute traded notional divided by wealth at the preceding close. Add those fractions across the evaluation period.

Buying approximately a full account and eventually selling it contributes approximately two units. Market gaps and the cost budget mean those units need not equal exactly two.

For the fixed 20-session rule, cumulative one-way turnover is approximately 177.88 over 1,432 evaluated sessions. Its mean daily turnover is approximately 0.1242. Multiplying by 252 gives roughly 31.30 units per assumed year.

This is different from a convention that divides traded notional by two, and different from counting completed trades. A strategy can have few trades and large notional changes, or many tiny trades.

State the definition before comparing reports.

A first-order break-even calculation

Suppose a strategy earns an expected gross return of 4 bp per session and turns over 0.8 times wealth per session under a compatible denominator. At a 5 bp one-way cost, its approximate cost drag is 0.8 × 5 = 4 bp per session.

The gross estimate has already been consumed. This rough comparison ignores compounding, state-dependent sizes and nonlinear impact, but it is enough to question a fragile result.

For compatible average gross return g and turnover τ, the first-order break-even one-way rate is:

cbreak−even≈gτ.c_{\mathrm{break-even}}\approx\frac{g}{\tau}.

A positive mean is still an estimate with uncertainty. It does not become reliable merely because we can divide it by turnover.

Approximate cost drag rises with both turnover and the one-way rate
Approximate cost drag rises with both turnover and the one-way rate
Invented 4 bp gross edge per session; linear approximation. The complete ledger is used for the actual experiment.

Stress the fixed policy

Run the same 20-session signal rule with several rates. Do not re-optimise the rule at each rate and call that a pure cost sensitivity test.

One-way costTerminal wealthTotal return
0 bp$101,125.45+1.13%
5 bp$92,514.17−7.49%
10 bp$84,636.17−15.36%
25 bp$64,803.58−35.20%
50 bp$41,527.44−58.47%

All rows use the same seeded synthetic fixture, $100,000 initial cash and sessions 80–1511. Entry and exit charges are applied to actual notional, including final liquidation.

Fixed-policy terminal wealth falls as the assumed one-way cost increases
Fixed-policy terminal wealth falls as the assumed one-way cost increases
No parameter reselection between these runs. Changing costs changes affordable share quantities and subsequent capital.

The table establishes sensitivity under this model. It does not establish which rate is realistic for a particular market. To estimate that, collect relevant execution data and compare orders of similar size, urgency and market conditions.

Why “the close touched my limit” is insufficient

A limit order can be displayed without filling. Earlier orders may have priority. The traded quantity may be too small to reach your place in the queue. A daily high or low also does not tell you the sequence of events inside the bar.

For the same reason, daily bars can fail to tell you whether a stop or profit target happened first. Resolving an ambiguous sequence in your strategy's favour introduces another optimistic assumption.

Our lab avoids those order types. It models next-open execution and a known terminal-close sale. Those remain price proxies, with costs supplied by assumption.

The market-making series explains why spread capture and post-fill price changes are separate quantities. Here we face the same issue from the trader consuming liquidity.

Add costs to the research question

An economic hypothesis should explain why a signal might predict a move large enough to compensate for obtaining and managing the position. It should also explain why the opportunity is not exhausted by the costs of acting on it.

A slower rule may trade less, but it can react later and hold unwanted exposure longer. Lower turnover alone is not a complete optimisation objective.

Before changing the rule, write the proposed cost mechanism, its units, and the observations that would support it. Keep the original sensitivity run as a reference.

In walk-forward validation, we will choose among five windows using earlier observations and evaluate the resulting selection process on later ones. Costs stay inside that selection calculation.
The full ledgers, assumptions and figures are in the backtesting resources. Subscribe separately on Substack to follow the remaining articles.

Until then, peace.

Go deeper with lessons, derivations and worked exercises behind this article.