A profitable backtest can turn unprofitable when it omits spread, slippage, or fees. Add those costs before trusting the result, because a small edge can disappear before the first real order is placed.
In September 1999, NASA’s Mars Climate Orbiter approached Mars after a journey of roughly nine months. The spacecraft was supposed to enter orbit. Instead, communication was lost.
The cause was a missing assumption at the boundary between two systems. One engineering team supplied thruster data in pound-seconds, while another part of the navigation software expected newton-seconds. NASA’s Mars Climate Orbiter Mishap Investigation Board documented the mismatch in its 1999 Phase I report. The calculations ran, the outputs looked usable, and the spacecraft continued toward Mars. The model and reality were speaking different units.
A beginner’s backtest can fail in the same shape. The code may calculate every entry and exit correctly while quietly assuming that each order fills at the displayed price, with no spread and no fee. The arithmetic works. The assumptions do not match the market.
A profitable result can depend on frictionless fills
Imagine a strategy tested across 200 trades. Its average gross profit is $0.18 per trade, so the report shows a $36 gain before trading costs.
That result answers a narrow question: would the entry and exit rules have made money at the prices recorded in the dataset?
It does not yet answer the question that matters: could a trader have captured those prices after the costs and uncertainty of execution?
Suppose an illustrative cost model adds $0.08 of spread, $0.06 of slippage, and $0.05 of fees per completed trade. The total cost is $0.19. A strategy that appeared to earn $0.18 per trade now loses $0.01 per trade.
Nothing about the trade logic changed. One missing assumption changed the conclusion.
This matters most for strategies with frequent trades or small targets. A position held for minutes may seek a narrow price move. Even modest execution costs can consume much of that expected gain. Increasing the number of trades then compounds the problem rather than rescuing the strategy.
Spread, slippage, and fees measure different costs
Spread is the gap between the price available to buyers and the price available to sellers. A chart may show a last-traded price, but an order usually interacts with the bid or ask. That difference creates an immediate hurdle.
Slippage is the difference between the expected fill and the actual fill. It can widen when price moves quickly, liquidity is limited, or the order is large relative to available volume. A backtest using candle closes often hides this uncertainty by granting an exact fill.
Fees are charges associated with executing the trade. Their structure depends on the broker, exchange, account, order type, and market. Current terms should be taken from the venue being modeled, not copied from an old tutorial or a “best broker” list.
Avoid collapsing all three into one optimistic estimate. Model them separately so you can see which assumption controls the result.
For example, run the same test under three execution cases:
- A favorable case uses a narrow observed spread, low slippage, and the applicable fee schedule.
- A base case uses typical observations from the instrument and trading window being tested.
- A stressed case widens spread and slippage during less favorable conditions.
These scenarios are estimates, not promises about future fills. Their purpose is to test whether the strategy’s conclusion survives reasonable friction.
Test the assumption that can reverse the result
Start with the average gross profit per trade. Then subtract estimated round-trip costs. If the remaining amount is close to zero, the strategy has little room for estimation error or changing market conditions.
Next, rerun the test with costs increased. Do not search for the smallest cost estimate that keeps the strategy profitable. Find the point where the result turns negative. That threshold tells you how fragile the apparent edge is.
Inspect the losing periods too. Costs may affect a strategy unevenly, especially when spreads widen or orders fill poorly during volatility. Average costs can hide the trades that cause the largest damage. Max drawdown, consecutive losses, and results by market condition deserve the same attention as total profit.
Position sizing comes after this work. A larger position may increase the money result, but it does not repair a negative expected result after costs. It only increases exposure to the same weak assumption.
Before committing capital, use paper trading or another controlled observation process to compare modeled fills with available fills. Record the expected price, actual fill, spread, fee, and timestamp. Build a trading journal from observed execution rather than memory.
That same habit supports approval-gated trading. An AI-generated trade can remain queued while a person checks whether the price, cost, position size, and risk still match the tested setup. If the available entry changes the planned loss, rejection is a valid decision. [The $23.75 exit Marcus didn’t plan for](\/blog\/the-23-75-exit-marcus-didn-t-plan-for-and-what-it-cost-his-account-f5d6efde\/) shows why execution belongs inside the risk calculation.
Record the unit beside every number
The Mars Climate Orbiter loss was not caused by an absence of calculations. It came from a mismatch hidden inside them. Backtests deserve the same discipline NASA’s investigation made unavoidable: define what every input means, which unit it uses, and where it came from.
Write down the spread model, slippage rule, fee schedule, order type, fill assumption, and testing period beside the result. Then change one assumption at a time and record where profitability disappears.
A backtest showing $36 of gross profit may look encouraging. A cost-adjusted test showing a $2 loss delivers more value before real money is committed.
Educational content, not financial advice.
Comments
No comments yet.