Commission Modeling BacktestsNovember 13, 202615 min read

Commission Modeling in Backtests: How to Get It Right

Learn how to model commissions in a backtest: entry and exit fees, spread, slippage, and sensitivity tests that show whether your edge survives real costs.

Commission Modeling in Backtests: How to Get It Right

Commission modeling means charging every simulated trade the fees a real broker would charge, on both entry and exit, so the backtest reports net results instead of gross ones. Do it per fill, match the fee schedule to the account you will trade, and then re-run the test with higher costs. If the edge disappears, it was never an edge. Strategies with small average gains per trade and high turnover are the ones that break first.

This guide shows how to calculate commissions, which other costs belong beside them, how to pick defensible assumptions, and how to test sensitivity. Backtestify is built for traders who want evidence on a strategy before risking capital, and cost realism is the part of that evidence most people skip.

TL;DR

  • Commission is only one cost. A realistic backtest also charges the spread, slippage, regulatory fees, and any borrow or financing costs.
  • Charge both sides of the trade: a round trip pays an entry fee and an exit fee, unless your schedule is quoted per round turn.
  • High-turnover strategies are the most exposed. One academic study found cost-driven divergence reaching 3.71% in total return for rotation strategies under heavy costs.
  • Choose assumptions that are a little too pessimistic, then raise them by 50% to 100% and see whether the strategy still earns money.
  • Check your platform's defaults. Some engines start at zero commission, and one popular library has a documented bug in how it applies the rate.

Table of Contents

What commission modeling means, and why it matters

A backtest replays your rules on historical prices. Left alone, it assumes every trade is free and fills exactly at the price your rule saw. That produces gross performance: what the signal would have earned at the mid-price with no friction at all. Net performance subtracts commissions, the bid-ask spread paid on entries and exits, market impact, and any financing or borrow fees. For a high-turnover strategy, the gap between gross and net can be the whole difference between a strategy worth trading and one that loses money.

What commission modeling means, and why it matters

The arithmetic is simple, and that is why it gets ignored. Costs are charged per trade, while edge is earned per trade. If your average winner after everything is small, a fixed cost per trade eats a large share of it. If you trade rarely and hold for weeks, the same cost is a rounding error.

Here is a hypothetical example, with made-up but plausible numbers. You trade 100 shares of a liquid stock and your rules earn $0.12 per share gross, so $12 per round trip.

Cost lineAssumptionCost per round trip
Commission$0.005 per share, each side$1.00
Spread$0.02 wide, half crossed on each side$2.00
Slippage$0.03 per share total$3.00
Net result$6.00

Half the edge is gone before you count any fee on the sale of the shares. Double those assumed costs and the trade is flat. A backtest that shows $12 per trade is describing a strategy nobody can trade.

Which costs a backtest should model

Researchers usually split transaction costs into explicit costs, implicit costs and capacity costs. Explicit costs are commissions, exchange fees, financing, borrow, and transaction taxes. Implicit costs are the bid-ask spread, slippage, and market impact. Capacity costs come from the size you trade relative to the market. Which one dominates depends on the strategy.

In practice, work through this list for each strategy:

  1. Commission. The explicit fee for execution, per share, per contract, per lot, or as a percentage of value.
  2. Spread cost. A market order buys at the ask and sells at the bid, so you cross the spread. A fair rule of thumb is about half the spread per side for a market order.
  3. Slippage. The gap between the price your rule saw and the price you got, worst in fast markets and on stop orders.
  4. Market impact. Your own order moving the price. It grows with order size relative to available liquidity and is the item most often skipped.
  5. Regulatory and exchange fees. In US equities, the SEC's Section 31 fee applies to sales. It was set at $20.60 per million dollars from April 4, 2026, a rate that is adjusted periodically, so check the current one.
  6. Borrow and financing. Short positions pay a borrow fee for every day they stay open, and margin positions pay interest. These grow with holding time, which a flat per-trade commission never captures.

A "zero commission" broker removes one line from this list, not the rest. Spread, slippage, regulatory fees and financing still apply.

How to calculate commissions on entry and exit

The core formula is the fee basis times the trade size times the number of sides charged. The details depend on the market.

Futures. The relevant number is the all-in rate, which bundles broker commission, exchange and NFA fees, and clearing fees. The cost of a full trade is contracts times the all-in rate times two, covering entry and exit. If your all-in rate is $2.50 per contract per side, trading 4 contracts costs 4 × $2.50 × 2 = $20 per round trip. If you are testing futures, our execution-first checklist for backtesting futures strategies covers where fills and costs go wrong in that market.

Stocks. Schedules come as a fee per share, a percentage of trade value, or a flat fee per order. Apply it on both the buy and the sell, then add the regulatory fee on the sale. Remember minimum fees per order: a $1 minimum matters when you trade 10 shares at a time.

Forex and CFDs. Check whether the schedule is quoted per side or per round turn. A per-side quote is charged twice on a round trip; a round-turn quote is charged once. Mixing these up doubles or halves your cost without any warning.

Options. Per-contract fees are fixed regardless of the option's price, so cheap contracts carry a much heavier relative cost than expensive ones. A backtest that uses a percentage of premium will understate the damage on low-priced contracts.

Commission charging methods across five market categories

Write the formula down for your broker and account type before you touch the backtest. The fee schedule should come from the broker you will actually use, not a generic number.

Per-fill modeling versus a flat percentage

The quick way is one flat percentage haircut on every trade. It is better than nothing, but it hides where the damage comes from. Per-fill cost modeling is more faithful because costs are path dependent: a flat percentage averages across fills, so it can understate costs where friction is highest and overstate them where it is low.

A per-fill model charges each fill its own commission, its own spread estimate and its own slippage. The practical payoff is diagnostic. If the net result collapses, you can see whether commissions, spread or slippage did it, and decide whether to trade less often, use limit orders, switch instruments or drop the idea.

A reasonable middle path, if your tool lacks full per-fill support, is to model commission exactly (it is known and fixed) and make spread and slippage functions of the instrument and, ideally, volatility, rather than one constant.

How much commissions change the answer

The damage scales with trade count. The clearest evidence comes from an academic study on implementation risk in portfolio backtesting. It found that cost-driven divergence rises steadily with cost intensity (Spearman ρ=0.93). It stayed below 0.75 percentage points for 12 of 15 benchmarks, but reached 3.71% in total return for high-turnover rotation strategies under the heaviest cost regime.

Read that carefully. For slow strategies, costs barely move the result. For fast ones, they can swamp it. That is why a swing trader and a scalper cannot reuse each other's cost assumptions.

To see the mechanism in your own numbers, use a quick test: gross edge per trade minus total cost per trade, multiplied by trades per year. Say a strategy makes 2,000 round trips a year with a 5 basis point gross edge each. If spread, impact and commission together average 6 basis points per round trip, the net edge is negative, and more trading only loses more.

The cost effect also reaches your other metrics. Win rate can stay the same while average win shrinks, so profit factor drops and drawdowns deepen. A profit factor that looks comfortable before costs can sit near 1.0 after them. Our piece on why a profit factor range alone misleads after costs walks through that interaction.

Choosing realistic assumptions

Pick numbers you could defend to a skeptical risk manager.

  1. Start from your real account. Use the commission schedule of the broker and account tier you will trade. A strategy that trades options needs per-contract fees, one that shorts needs borrow costs, and one that uses margin needs financing costs. Do not carry an equity fee model into a futures test.
  2. Look at the instrument. Check the typical spread at the time of day you trade, not the tightest spread of the session. Opens, closes and news windows are wider.
  3. Match order type to cost. Market orders cross the spread and risk slippage. Stops can fill well beyond their trigger during volatility. Limit orders save the spread but may miss fills, which a backtest must also model.
  4. Scale to your size. A 100-share order and a 50,000-share order do not face the same impact.
  5. Err conservative. Set assumptions slightly worse than you expect rather than selecting values that preserve a pretty equity curve. Getting it wrong on the pessimistic side costs you an opportunity; getting it wrong on the optimistic side costs you capital.

If you trade very short timeframes, the price path inside each bar changes how fills would have occurred. Tick data backtesting explains when that detail matters and when bar data is enough.

Sensitivity testing: how fragile is the edge?

One cost assumption gives one answer. A sensitivity test gives you the range, which is what you need to make a decision.

  1. Run the strategy at zero costs to get the gross baseline.
  2. Run it at your best estimate of real costs.
  3. Run it at 1.5 times and 2 times your estimate for commission, spread and slippage.
  4. Plot net profit, profit factor and maximum drawdown across the runs.
  5. Find the breakeven: the cost level at which net profit hits zero.

The breakeven is the number to remember. If it sits barely above your estimate, the strategy has no margin of safety, because a wider spread in a volatile week or a fee change would erase it. If it sits at four or five times your estimate, costs are not what threatens the strategy, and you can look at other risks.

Two habits make the test stronger. First, vary one cost at a time so you learn which one matters. Second, change how the strategy trades, not just the fee: a wider stop or a longer holding period often cuts trade count, which cuts cost drag more than any broker switch would. That is also where overfitting creeps in, so read how to optimize a strategy without overfitting before you tune around costs. To see the spread of outcomes, Monte Carlo backtesting reshuffles trades to show how deep losing streaks can run once costs are in.

Check your platform's settings and defaults

Never assume the engine models costs the way you expect. Two documented issues show why.

A short verification routine catches both. Run a single trade by hand with a known price, size and fee. Compute the expected commission on paper using the formulas above. Compare it with the engine's trade log, entry and exit separately. If the numbers disagree, fix the settings before you run anything larger.

Also confirm whether the engine charges commission on both sides, whether minimums apply, whether the spread is modeled at all, and whether short borrow and margin interest are included. If the answer to any of these is "no", add the cost yourself in your results.

Putting costs into a repeatable test

The full process for a credible backtest is in our step-by-step guide to backtesting a trading strategy. Cost modeling fits into it at three points: when you define the rules (so trade frequency is known), when you set the assumptions (broker, instrument, order type), and when you judge the output (gross against net, then sensitivity).

Backtestify lets you enter a strategy in plain English and test it on real historical market data. Reports show win rate, profit factor and maximum drawdown, trade by trade, which is how you see whether a small average gain per trade can carry a fee. The platform also publishes results for winning and losing strategies in its published strategy library, so you can see what a full report looks like before you test your own idea.

Test your strategy with Backtestify

If you want to know whether a setup you saw online survives a rigorous test, run it on historical data and read the trade-by-trade results. Backtestify offers a Free plan, and Pro costs $29 per month or $190 per year, with unlimited backtesting, improvement and forecasting. You can compare an original strategy with an improved version side by side on recent data and export results in TradingView Pine script format.

Backtestify

Start on the Free plan or upgrade to Pro

FAQ

Do I need to model commissions if my broker charges none?

Yes, because "zero commission" removes one line, not all of them. Spread, slippage, regulatory fees on sales, per-contract fees on options, borrow charges on shorts, and margin interest can all still apply. Model those so the net result reflects real trading.

Are commissions charged on entry, exit or both?

Usually both. A fee quoted per side is charged twice on a round trip, while a fee quoted per round turn covers entry and exit once. In futures, the cost of a full trade is contracts times the all-in rate times two.

Should I use a flat percentage or per-trade fees?

Use the structure your broker uses. Per-share, per-contract and per-lot schedules behave differently from a percentage of value, especially on small or cheap trades. A flat percentage works for a quick first pass, but per-fill modeling shows where the costs actually bite.

How do I know if my strategy is too sensitive to costs?

Re-run it at 1.5 times and 2 times your cost estimate and find the breakeven cost level. If net profit disappears at costs only slightly above your estimate, the edge is thin. High-turnover strategies are the most likely to fail this test.

What commission value should I use for a quick test?

Take the real schedule of the broker and account you plan to use, then add a conservative spread and slippage estimate for your instrument. Avoid borrowing a number from a different asset class or account type.

Sources