How much do fees and slippage change a backtest?
Short answerOften enough to turn a winning backtest into a losing one. Each round trip pays a fee on the buy and the sell, half the spread and any slippage on each side, plus funding on perpetual futures. At Binance's base Spot fee of 0.10% per side (as of 26 November 2026) and an illustrative 0.05% per side for spread and slippage, a round trip costs about 0.30%. If each trade reinvests the whole balance, a rule breaks even only if its trades compound to more than about 0.30% each before costs; a simple average above 0.30% is not enough when results vary widely. In the synthetic example below, a fast moving-average rule made +17.1% before costs and lost 6.8% after them.
The more often a rule trades, the larger the share of its gross gain that costs take, and compounding decides the close cases. A slower rule on the same candles averaged +0.61% per trade before costs, but its uneven trades compounded to only +0.55% each, so it kept +5.0% at 0.30% per round trip and lost 1.1% at 0.60%. Before you trust a backtest, check which costs it charged and whether its compounded gain per trade clears them with room to spare.
Valmy noteAs specified on 25 November 2026, Valmy backtests use a versioned cost model with a configured fee, spread and slippage model, simulate each fill on a candle after the signal, and report costs split into fees, a slippage estimate and funding. Details in the live app could differ, so check them there. Nothing in this lesson is a recommendation to trade a rule.
What one round trip costs: fees, spread, slippage and funding#
A round trip is one buy and one sell. A backtest that ignores its costs assumes you bought and sold at the exact prices on the chart for free. Four costs separate that assumption from a real fill:
- Fees. The exchange charges a percentage of each trade's value, on both sides. Binance's base Spot rate was 0.100% per side as of 26 November 2026. See How much do trading fees cost me over a year?.
- Half the spread. A market buy pays the ask and a market sell receives the bid. Measured from the middle of the market, each side costs half the spread, so a round trip pays the whole spread. See Why did I pay more than the price on screen?.
- Slippage. An order larger than the best quote, or one sent while the price is moving, fills at worse prices than the quote it saw.
- Funding, for perpetual futures. Binance's funding FAQ says that when the funding rate is positive, longs pay shorts, and when it is negative, shorts pay longs. The FAQ's default interval is every 8 hours, at 00:00, 08:00 and 16:00 UTC, but intervals vary by contract and can change: on 26 November 2026 most USDⓈ-M perpetuals settled every 4 hours, while BTCUSDT settled every 8. Only positions open at that moment pay or receive, and the amount is the position's notional value × the funding rate. See What is a perpetual future, and what does funding do?.
The per-trade cost formula#
For a round trip with a fee f per side and an execution cost e per side (half the spread plus slippage):
Round-trip cost ≈ 2 × (f + e), plus funding paid while the position is open.
With f = 0.10% and e = 0.05%, the round trip costs about 2 × 0.15% = 0.30% of the position. More exactly, when the fee is taken from the amount traded and the execution cost moves the fill price, a round trip keeps a fraction K = (1 − f)² × (1 − e) ÷ (1 + e) of the position. If the price stands still, the share lost is 1 − K: 0.2997% here, which also rounds to 0.30%. This lesson calls 0.30% the base cost and 0.60% (fee 0.20% and execution cost 0.10% per side) the doubled cost. The 0.05% execution cost is illustrative, not measured: a liquid pair traded in small size can cost less, and a thin market or a fast move can cost much more.
Break-even: the compounded gain a trade must clear#
When each trade reinvests the whole balance, every round trip multiplies the balance by 1 plus its gross return g, and costs multiply it again by K. The balance grows only if (1 + g) × K is above 1, so the exact break-even gross gain is 1 ÷ K − 1. That is 0.3006% at the base cost and 0.6022% at the doubled cost, slightly more than the share lost on a flat trade (0.2997% and 0.5986%), because costs also take their cut of the gain. For a series of trades, the gross gain to compare with this break-even is the compounded gain per round trip, also called the geometric mean: the one per-trade return that, repeated on every trade, turns the starting balance into the final one, (final balance ÷ starting balance)^(1 ÷ number of round trips) − 1. Rounded to the two cost levels in this lesson:
- Compounded gain above about 0.30% per trade: the rule makes money at the base cost.
- Between about 0.30% and 0.60%: it makes money at the base cost and loses at the doubled cost.
- Below about 0.30%: it loses after costs, however good the chart looks.
Most of a backtest's apparent profit can hide in that gap. A rule whose trades compound to 0.25% each before costs is a losing rule at 0.30% per round trip.
Simple average or compounded gain: why the difference decides#
The simple average of per-trade returns, their sum divided by the number of trades, is never below the compounded gain, and the gap widens as results vary more. A gain of 10% followed by a loss of 10% averages 0%, yet leaves 1.10 × 0.90 = 0.99 of the balance, a 1% loss. A useful rule of thumb: compounded gain ≈ simple average − half the variance of per-trade returns, where the variance is the square of their standard deviation. So a rule can show a positive simple average after costs and still lose money, while a simple average below the cost always means a loss.
The two figures are close when trade results are similar in size, as for the fast rule below. For a rule carried by a few large gains among many small losses, such as the slow rule, compute the compounded figure from the final balance before comparing it with the cost. The simple average is the right test only when every trade uses the same fixed amount, such as 1,000 USDT each time, because gains and losses then add up instead of compounding.
Turnover: why trading more often multiplies cost#
Turnover is how much a strategy trades relative to its capital. For a rule that puts its whole balance into each trade, turnover is simply the number of round trips. Each round trip pays the full cost, so costs per day are about round trips per day × round-trip cost:
- A rule that makes 2 round trips a day pays about 2 × 0.30% = 0.60% of its position per day.
- A rule that makes 7.6 round trips a day pays about 2.28% per day.
Trading more often does not make each trade earn more, while every extra trade pays the full cost again. Rules on five-minute candles can trade often: in the example below, a crossover of short averages made 7.6 round trips a day.
Worked example: one crossover rule at three cost levels (synthetic data)#
The same signals gave very different results at different costs. Before costs, a fast crossover made +17.1% in ten days. At 0.30% per round trip it lost 6.8%, and at 0.60% it lost 25.8%. A slower crossover on the same candles made +11.5%, +5.0% and −1.1%. The data are 2,880 invented five-minute candles (ten days) of a made-up token quoted in USDT, designed with rising, falling and sideways stretches so that a crossover makes money before costs, plus 100 earlier candles of history for the averages. Both rules are long or flat:
- Fast rule: buy when the simple moving average of the last 5 closes, SMA(5), crosses above SMA(20); sell when it crosses below.
- Slow rule: the same with SMA(20) and SMA(100).
Each signal at a candle's close fills at the next candle's open, plus the execution cost. Each trade uses the whole balance, starting from 1,000 USDT. The signals and trades are identical at every cost level; only the fill prices and fees change.
| Result over ten days | Fast rule SMA(5)/SMA(20) | Slow rule SMA(20)/SMA(100) |
|---|---|---|
| Round trips | 76 (7.6 a day) | 20 (2.0 a day) |
| Winning round trips before costs | 29 | 4 |
| Simple average per round trip before costs | +0.21% | +0.61% |
| Compounded gain per round trip before costs | +0.21% | +0.55% |
| Result with no costs | +17.1% | +11.5% |
| Result at 0.30% per round trip | −6.8% | +5.0% |
| Result at 0.60% per round trip | −25.8% | −1.1% |
For comparison, holding the token from the first possible entry to the end of the test made +15.6% before costs and +15.2% after one round trip at 0.30%. After costs, holding beat both rules here, a reminder that a strategy should also be compared with doing nothing special, as How do I compare a strategy with simply holding? explains.
Fast rule against slow rule: how turnover reverses the ranking#
Before costs, the fast rule looked better: +17.1% against +11.5%. At 0.30% per round trip the ranking reversed. The reason is each rule's compounded gain per trade before costs, set against the break-evens:
- The fast rule's trades compounded to +0.21% each, below the 0.30% break-even. At the base cost they compounded to −0.09% each, and 76 such trades cost it 23.9 percentage points of return.
- The slow rule's trades compounded to +0.55% each, between the 0.30% and 0.60% break-evens. At the base cost they compounded to +0.25% each, and its 20 trades cost it 6.5 points. At the doubled cost they compounded to −0.06% each, a loss of 1.1%.
Only 4 of the slow rule's 20 trades won before costs, and a few large gains carried the result. Missing one of those trades would change it, which makes the result fragile in a different way, but costs at the base level did not destroy it.
Why the slow rule's 0.61% average still lost at 0.60%#
The slow rule's simple average before costs, +0.61% per round trip, sits just above the 0.60% doubled cost, yet the rule lost 1.1% at that cost. After doubled costs, the simple average of its 20 results was still +0.01% per trade; compounded, they came to −0.06% per trade. The cause is how uneven the trades were: before costs they ranged from a loss of 0.95% to a gain of 15.7%, a standard deviation of about 3.8% per trade. Half the variance, 3.77% squared and halved, is about 0.07 points, close to the gap between the simple average (0.61%) and the compounded gain (0.55%). The fast rule's trades varied far less, with a standard deviation of 0.90%, so its two figures matched at 0.21%. Judged by the simple average, the slow rule looked safe at doubled costs; judged by compounding, it was not.
Where the money went: fees and the slippage estimate#
The table splits the costs the same way Valmy's backtest report is specified to: fees and a slippage estimate, here measured against each candle's open.
| Costs over ten days (USDT) | Fast, 0.30% | Fast, 0.60% | Slow, 0.30% | Slow, 0.60% |
|---|---|---|---|---|
| Fees | 144.35 | 258.55 | 41.54 | 80.64 |
| Spread and slippage estimate | 72.14 | 129.15 | 20.76 | 40.28 |
| Total trading costs | 216.49 | 387.69 | 62.29 | 120.92 |
| Average cost per round trip | 2.85 | 5.10 | 3.11 | 6.05 |
At the base cost of 0.30% per round trip, the fast rule paid 216.49 USDT in trading costs on a 1,000 USDT account in ten days, more than its entire 171.19 USDT gain before costs. Fees were two thirds of the total, because the fee is 0.10% of the 0.15% charged per side. The slow rule's cost per round trip was slightly higher in USDT because its balance was larger when it traded, but it paid that cost only 20 times.
Funding if the same trades ran on a perpetual (modeled)#
A Spot backtest pays no funding. If the same trades had run on a USDT-settled perpetual at 1× leverage, a long position would also pay funding at each 8-hour settlement it was open for. With a hypothetical funding rate of +0.01% per 8 hours, the fast rule would have paid 1.71 USDT and the slow rule 1.86 USDT over the ten days, across 30 settlement times. That is small next to their trading costs because both rules were often flat at settlement. A rule that holds a long position for days pays funding at every settlement, and real funding rates change and can turn negative, so a short can pay too. Futures fees also differ from Spot fees: the base taker rate on Binance USDⓈ-M futures was 0.0500% per side as of 26 November 2026, according to the fees lesson linked above.
How Valmy's backtests account for costs, as specified#
As specified on 25 November 2026, Valmy's backtest mode uses a pinned historical dataset and a versioned cost model. It evaluates the rule at each candle's close and simulates the earliest execution on a later candle using the configured spread, slippage and fee model. For futures it imports mark prices, funding at the actual event times and risk-tier assumptions. The user-visible result is specified to include orders and fills, an equity series, net return, maximum drawdown and costs broken into fees, slippage estimate and funding, with market impact and the order of events inside a candle labeled as approximations.
When a user submits a backtest, the client API is specified to take the strategy version, instrument, UTC date range, starting balances and the selected cost-model version, and the replay record pins the fee schedule, slippage model and funding data used. Two consequences for reading a result:
- The cost model is a choice. A result is only as reliable as the fee rate and slippage it assumed. Run the same version under a harsher cost model before trusting a thin edge.
- History cannot recover everything. Valmy's market-data specification notes that historical trades alone cannot reconstruct queue position, full order-book depth, a user's fee tier or every past risk bracket, so slippage in a backtest is an estimate.
What could change the conclusion about costs#
The example used one synthetic market and fixed costs. Real costs move, in both directions:
- Fee tier and maker fills. A higher volume tier, the BNB discount or orders that rest in the book as makers pay less than the base taker rate. A resting order may also fill late or not at all, which changes the trades themselves.
- Spreads and depth change. Spreads widen and depth thins in fast markets, which is often exactly when a rule's signals fire. A fixed 0.05% can understate the cost of trading during a sell-off.
- Size. Slippage grows faster than order size once an order walks the book. A rule that works with 1,000 USDT may not work with 100,000.
- Funding swings. Funding rates change every settlement and can be large in crowded markets. A long-only rule on a perpetual pays during periods of positive funding.
- Uneven trades. A rule carried by a few large trades compounds to less than its simple average. When its compounded gain per trade sits close to the cost, a small rise in costs or one missed trade can flip the result.
- Published evidence agrees that turnover is the weak point. Bajgrowicz and Scaillet (2012) revisited technical trading rules on the Dow Jones Industrial Average from 1897 to 2011 and found that even in-sample, low transaction costs completely offset the rules' performance. In a study of stock-market anomalies, Novy-Marx and Velikov (2016) found that most strategies with one-sided monthly turnover below 50% kept significant net returns when built to limit costs, while few higher-turnover strategies did. Neither study covers five-minute crypto candles, but both point the same way as this example.
Check your understanding: costs on a high-turnover futures rule#
Question. A backtest of a rule on a USDT-settled perpetual makes 120 round trips in a month. Each trade reinvests the whole balance, and the trades compound to +0.12% each before costs: the balance grew as if every trade had gained exactly 0.12%. The trader expects to pay the base taker fee of 0.05% per side and assumes 0.02% per side for spread and slippage.
- What does one round trip cost, and what is the compounded result per trade after costs?
- What are the results over the month before and after costs?
- A slower version makes 30 round trips a month whose trades compound to +0.40% each before costs. What is its net result, with the same costs?
- A third version makes four trades with returns before costs of +10%, −3%, −3% and −3%. Their simple average is +0.25% per trade, above the 0.14% cost. Does it make money after costs?
- The slower version holds a 2,000 USDT long through all three funding settlements every day. With a funding rate of +0.01% each time, how much funding does it pay per day and over 30 days?
Show the answers
Answer.
- One round trip costs 2 × (0.05% + 0.02%) = 0.14%, so each trade keeps 0.9986 of the balance after costs. The compounded result per trade is 1.0012 × 0.9986 − 1 ≈ −0.02%.
- Before costs: 1.0012^120 ≈ 1.155, a gain of about 15.5%. Costs alone multiply the balance by 0.9986^120 ≈ 0.845. Together: 1.155 × 0.845 ≈ 0.976, a loss of about 2.4%. The rule's gain per trade is real in the backtest but smaller than its cost.
- Each trade nets 1.004 × 0.9986 − 1 ≈ +0.26%, and 1.0026^30 ≈ 1.081, about +8.1%. Fewer trades with a larger compounded gain each survive the same costs.
- No. Before costs the four trades multiply the balance by 1.10 × 0.97 × 0.97 × 0.97 ≈ 1.0039, a compounded gain of about 0.10% per trade, below the 0.14% cost. After costs: 1.0039 × 0.9986^4 ≈ 0.9983, a loss of about 0.17%, even though the simple average after costs is still about +0.11% per trade. Uneven results compound to less than their simple average.
- 2,000 × 0.0001 × 3 = 0.60 USDT per day, or 18.00 USDT over 30 days, 0.9% of the position. Funding is small next to the trading costs here, but it is paid every day the position stays open, and a higher or more persistent rate would raise it. Both results ignore that real rates change from one settlement to the next.
Related lessons#
- Before this lesson: How do I turn something I noticed on a chart into a rule I can test?, Why did I pay more than the price on screen? and How much do trading fees cost me over a year?
- Next: What is look-ahead bias, and how does it get into a backtest?
- See also: How do I compare a strategy with simply holding?
- See also: What is a perpetual future, and what does funding do?
- See also: What does a moving average actually measure?
- See also: How deep can a drawdown get, and how long does recovery take?