I Added a 0.1% Fee to the Strategy. It Lost $1,593 — and the Fee Was Only $359 of It.
The short version. Post #18 ended with an open item: every number in this series so far ran with no commission and no slippage. This post closes it — same trailing-exit script, same 2×ATR stop, same 4,089 bars, but with a 0.1% round-trip fee (0.05% per side). The strategy kept +$937.45 of its +$2,530.24, Profit Factor 1.117 against 1.302, in our testing. The fee itself took only $359.12 — 4.0% of gross profit, $7.64 a trade. The other $1,233.67 of the damage never appears on any fee line: the fee pushed the account $51.41 short of affording one entry, so the order was dropped silently — and that entry was the trail's third-biggest winner, +$925.95 — and the lower equity path shrank seven later positions from 3 contracts to 2. On a fully-invested strategy, a fee doesn't just subtract. It compounds through sizing and affordability.
| No costs (#18) | 0.1% round-trip (#20) | |
|---|---|---|
| Closed trades | 48 | 47 |
| Stop exits / trail exits | 19 / 29 | 19 / 28 |
| Net profit | +$2,530.24 | +$937.45 |
| Profit Factor | 1.302 | 1.117 |
| Win rate | 19 / 48 (39.6%) | 18 / 47 (38.3%) |
| Gross profit / gross loss | +$10,908.26 / −$8,378.02 | +$8,951.70 / −$8,014.25 |
| Avg win / avg loss | $574.12 / −$288.90 | $497.32 / −$276.35 |
| Avg hold | 17.04 bars | 16.15 bars |
| Median trade | −$161.62 | −$172.61 |
| Max equity drawdown | $1,881.50 (18.82%) | $2,231.62 (21.01%) |
| Top-5 winners' share | 63.7% | 67.6% |
| Net minus biggest winner | +$168.70 | −$936.86 |
The contract: one question, chosen before I looked
Post #18's "What I couldn't verify" listed costs first, word for word: "No commission, no slippage, same as every post in this series. The trail run trades 48 times in 16 years with an average hold of 17 bars, so costs would bite less here than on a fast strategy — but 'less' is not a number, and I haven't run it with costs." This post is that run, and the fee is fixed before I look: 0.05% of notional on every order — 0.1% round trip — applied through Pine's own commission_type / commission_value, not hand-subtracted afterwards.
Three questions, in order:
- How much does the fee itself take — in dollars, per trade, and as a share of gross profit?
- Does the fee change anything besides the subtraction — entries, exits, position sizes?
- Is the strategy still standing after costs, or was the whole +$2,530.24 a zero-cost artifact?
The script is post #18's fixed RSI mean-reversion strategy, byte-identical apart from the strategy() line and the title string. Same 4,089 daily bars of CSI 300 (2010-01-04 → 2026-11-06), same $10,000, same PyneCore patched runtime, no slippage. The fee is charged by the runtime on every fill — entry and exit — at 0.05% of the fill notional.
A fee on a slow strategy looks harmless in the fee column. The damage is in the orders the fee quietly prevents.
The one-line change, in Pine — the commission arguments added to the strategy() call, nothing else touched:
strategy("RSI Mean Reversion (trailing exit, stop 2xATR, fee 0.1% round-trip)", overlay=true, initial_capital=10000,
commission_type=strategy.commission.percent, commission_value=0.05,
default_qty_type=strategy.percent_of_equity, default_qty_value=100)
And the compiled Python, verbatim from the local compiler (node bin/pine2pyne.mjs, zero diagnostics) — the commission arguments pass through untouched:
@script.strategy(title="RSI Mean Reversion (trailing exit, stop 2xATR, fee 0.1% round-trip)", overlay=True, initial_capital=10000, commission_type=strategy.commission.percent, commission_value=0.05, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
Before the numbers, one mechanic worth stating, because it decides what the numbers mean: this strategy sizes at 100% of equity. Every dollar of fee leaves the account, so every later entry is sized off a smaller equity number — and an order whose fill cost exceeds equity is not reduced, it is dropped entirely, silently, the same failure mode post #19 caught at bar 1660. Both show up in the results below.
The one line that matters is commission_value=0.05. Everything this post claims about "costs" lives in that one number: 0.05% per side, 0.1% round trip. If the result looks small, remember the rate before you blame the strategy — and if it looks big, remember the rate before you blame the fee.
Probe 1: the headline — the fee took $359, the strategy lost $1,593
47 closed trades against 48, net +$937.45 (+9.37% on $10,000) against +$2,530.24, PF 1.117 against 1.302. The gap is −$1,592.79 — 63% of the no-cost net gone.
The fee column itself is small, and I verified it trade by trade rather than trusting the total: on every trade that ran the same number of contracts in both runs, the fee charged equals 0.05% × (entry notional + exit notional) to the cent, 40 out of 40 trades, zero mismatches. Total fees paid on the 47 closed trades: $359.12 — mean $7.64 a trade, 4.0% of the fee run's gross profit. The biggest single fee in the run was $9.59. No winner flipped to a loser on the fee alone: on same-size trades, zero sign flips.
So the arithmetic is clean and the fee is small — and the strategy still lost $1,593. The fee is $359 of that. The remaining $1,233.67 is not a fee. It is what the fee did to the rest of the run, and it splits into two pieces, both measured below.
One more number from the table before the probes: the median trade loses money in both runs — −$172.61 with fees against −$161.62 without. And net minus the biggest winner is now negative (−$936.86): without its best trade, the fee run loses money. In #18 that number was +$168.70 — barely positive, but positive. Costs didn't just shrink the profit. They moved the whole strategy across the breakeven line on the concentration check.
Probe 2: the $51.41 shortfall — the entry that never happened
The fee run has 48 entries. The no-cost run has 49. The missing one is the entry the trail run was built around: 2015-08-28, bar 1373 — trade #20 in #18, the trail's third-biggest winner, +$925.95 over 59 bars. I checked it three ways before writing this:
- The signal fired. The script is byte-identical apart from the commission line, the RSI computation is untouched, and the no-cost run filled at bar 1373's open, 3,246.24. The signal is not the problem.
- The position was flat. Trade #19 exited at bar 1351 in both runs. Nothing was holding the slot.
- The arithmetic is the problem. Sizing is 100% of equity, computed off the signal bar's close. The signal bar (2015-08-27) closed at 3,205.64. In the fee run, equity before that signal was $9,687.31 — the $10,000 start minus $312.69 of cumulative losses, of which $156.72 was fees paid on trades 1–19. Quantity: floor(9,687.31 / 3,205.64) = 3 contracts. The fill price is the next bar's open, 3,246.24: 3 × 3,246.24 = $9,738.72 — $51.41 more than the account held. PyneCore dropped the order. No diagnostic, no trade row, no note in any CSV. The tick just never happened — the exact failure mode post #19 caught at bar 1660, where the shortfall was $26.73.
The base run, for comparison, had $9,844.03 of equity at the same signal — headroom of $105.31 over the same $9,738.72 fill. The no-cost run nearly dropped this order too. The fee didn't create the fragility; it spent the last $51.41 of a $105.31 buffer that was already thin. One hundred percent of equity, sized off the signal close and filled at the next open, means every entry is a coin flip on the overnight gap — and the fee run lost this particular flip by fifty-one dollars.
That one dropped order is $925.95 of the $1,592.79 gap — 58% of it. The fee's largest single effect is not a fee at all. It is a winner that never traded, removed for a reason that has nothing to do with what the market did next.
Probe 3: the decomposition — three losses, only one of which is a fee
| Loss | Dollars | Share of the $1,592.79 gap |
|---|---|---|
| Direct fees, 47 closed trades | −$359.12 | 23% |
| Sizing drift on the 47 matched trades | −$307.72 | 19% |
| The dropped entry (#20, +$925.95) | −$925.95 | 58% |
| Total | −$1,592.79 | 100% |
The decomposition closes to the cent: −359.12 − 307.72 − 925.95 = −1,592.79. Each piece is measured, not allocated:
Direct fees, −$359.12. Verified per trade above: 0.05% per side, 40/40 same-size trades exact. Mean $7.64, max $9.59. This is the number most cost analyses stop at — and it is the smallest of the three.
Sizing drift, −$307.72. The fee run's equity path sits lower throughout, so percent-of-equity sizing buys fewer contracts on later entries. Seven closed trades ran short: six dropped from 3 contracts to 2 (entries 2016-01-11, 2016-01-15, 2016-02-01, 2024-09-20, 2025-04-10, 2026-10-12) and one from 2 to 1 (entry 2021-07-30). Smaller size cuts both wins and losses; on these seven trades the net effect was −$307.72. The biggest winner took the biggest cut: trade #45 (entry 2024-09-20), +$2,361.54 at 3 contracts in the no-cost run, ran at 2 contracts with fees — its gross fell by $787.18 before the fee even touched it. That is why the fee run's biggest winner is a different trade (#14, entry 2012-12-03, +$1,874.31) — #45 didn't shrink, it was out-shrunk.
The dropped entry, −$925.95. Probe 2, above. A $51.41 affordability gap removed the trail's third-biggest winner entirely.
Read the table in the order the money actually left: the fee is the smallest loss, the sizing drift is the middle one, and the silent drop is the largest. A cost analysis that only adds up the fee column would report −$359.12 and miss 77% of the damage. On a fully-invested strategy, costs compound through the sizing rule — and the sizing rule here (100% of equity, fill at next open) is what turns a $7.64 average fee into a $1,593 hole.
Probe 4: what the fee didn't change — and the concentration it made worse
The fee changed the money, not the logic. On the 48 entries both runs share, every exit bar is identical — the trail and the stop are price rules, and prices didn't move. The stop column is still exactly 19 exits, 0 wins in both runs; the trail column is 28 against 29 only because the dropped #20 was a trail exit. Average hold barely moved (16.15 bars against 17.04 — the dropped trade held 59 bars, and removing a long hold pulls the average down). No trade changed its exit reason. The strategy, as a set of decisions, is the same strategy. Only the account is smaller.
What got worse is the concentration. The top 5 winners are now 67.6% of gross profit (was 63.7%), and net minus the biggest winner is −$936.86 (was +$168.70). The fee run's biggest winner (#14, +$1,874.31) is smaller than the no-cost run's (#45, +$2,361.54) because #45 lost a contract — so the fee run leans harder on a smaller best trade. Max drawdown deepened too: $2,231.62 (21.01%) against $1,881.50 (18.82%). Costs didn't diversify the strategy. They concentrated it.
The honest read, in one line: the strategy survives a 0.1% round-trip fee — +$937.45, PF 1.117, still positive — but only just, and only because one trade (#14) held it up. Take #14 out and it loses $936.86. The no-cost +$2,530.24 was never a $2,530 strategy. It was a $937 strategy wearing a zero-cost costume, one dropped order away from a worse number.
What I couldn't verify
- Slippage. Still not modelled. Every fill here is at the next bar's open, exactly — no gap between the trigger close and the fill beyond the open itself, no spread, no partial fills. On daily bars with a 17-bar average hold, slippage would bite less than on an intraday strategy — but "less" is not a number, and I haven't run it.
- Whether 0.1% is the right rate. 0.05% per side is a round, slightly conservative number for the market this index tracks — real round trips can be cheaper or dearer depending on broker, stamp duty, and whether the fill crosses a spread. I tested one rate, not a schedule. A 0.05% round trip would cost roughly half the direct fee — but the dropped-entry mechanism doesn't scale linearly with the rate, so I won't guess what it would do.
- Whether the trail distance is special. 2×ATR was inherited from the stop, not chosen — and #18 already flagged it. The next post tests it: 1×, 2× and 3×ATR trails on the same script, same entries, same 0.1% fee, promised to Kamal in the #18 comments. That test is fixed before I look.
- Out of sample. Same 4,089 bars as every post in the series. Nothing here has been tested on data the script hasn't already seen.
Bottom line
A 0.1% round-trip fee cost this strategy $1,592.79 — 63% of its no-cost net — and only $359.12 of that was the fee itself. The rest was the fee interacting with 100%-of-equity sizing: $307.72 of shrunken positions, and a $925.95 winner that never traded because the account was $51.41 short of affording it. The strategy still ends positive (+$937.45, PF 1.117, in our testing), but net minus its biggest winner is now −$936.86: without one trade, costs turn it into a loser. The lesson isn't "fees are expensive" — $7.64 a trade is cheap. The lesson is that on a fully-invested strategy, the fee column is the smallest part of what costs cost you. Check the orders that never fired.
Have you ever added costs to a backtest and found the damage was nowhere near the fee column? I read every comment — the cost stories are what the next posts are built from.
This conversion work was done by Pine2Py, the tool I build for exactly this job: paste a Pine script, get PyneCore-flavored Python back, diagnostics included when something can't be translated. The runtime is the open-source PyneCore project, with a patched build we ship for the two constructs stock PyneCore doesn't handle — details are on the site. It's free to try — every account gets 3 conversions, no card — and Pro is $12/month if you end up converting a whole library. No return promises, ever: a translator moves your logic, it doesn't make it profitable.
Top comments (4)
Post #19's cost-headroom question now has an answer — and it's worse than the fee column says. Your $7.64/trade fee is real, but the $1,592.79 gap is 4.4x the $359.12 fee column, and the fee is the smallest of the three losses. The number that matters most is the $51.41: the no-cost run's headroom on that entry was only $105.31, so the fragility was already there — the fee just spent the last half of it. Two silent drops now (bar 1660 at $26.73, bar 1373 at $51.41) make this a pattern, not an accident: 100%-of-equity sizing off the signal close, filled at the next open, means every entry is a coin flip on the overnight gap, and the loser just never appears in any CSV.
One check that would split the fee from the rule: re-run with the dropped entry force-filled at 3,246.24 (or with the order reduced to the affordable quantity instead of dropped) and see how much of the $1,592.79 gap survives. If most of it disappears, the lesson isn't "fees are expensive" — it's "the sizing rule is what the fee broke." Sizing off the fill price, or capping at 95% of equity, would be the fix worth testing next — cheaper than arguing about the commission rate, and it protects the entries that actually carry the strategy: net minus the biggest winner is now -$936.86, so after costs the whole edge is one trade.
You're right to reframe it — the fee is the smallest of the three losses, and the $51.41 is the number that matters. The headroom was already $105.31 before the fee touched it; the fee just spent the last half. And yes, two silent drops (bar 1660 at $26.73, bar 1373 at $51.41) is a pattern, not an accident: 100%-of-equity sizing off the signal close, filled at the next open, makes every entry a coin flip on the overnight gap — and the loser never shows up in any CSV.
The split test you describe is the right next one: force-fill the dropped entry at 3,246.24 versus reduce to the affordable quantity, and see how much of the $1,592.79 gap survives. That test is queued after #21 (the 1x/2x/3x ATR trail-distance test already promised in this thread).
One question while that queues: if you had to pick one fix to test first — sizing off the fill price, or capping at 95% of equity — which would you bet on, and why?
Sizing off the fill price — and it isn't close. The two drops weren't a leverage problem, they were a measurement problem: affordability was tested against the signal close, a price that never actually trades, and then the fill happened at a different number. A 95% cap treats that symptom with a buffer, and the buffer only looks sufficient because the two shortfalls we have sampled ($26.73 and $51.41 on roughly $9.9k of equity) are small — the cap's protection ends exactly where the overnight-gap distribution's tail begins, and the tail is the part we haven't sampled yet. Fill-price sizing removes the failure class instead of sizing the bandage: the quantity is computed from the price the order will actually pay, so the affordability test and the fill can never disagree.
One confound to watch when you run it: fill-price sizing changes every position slightly, not just the marginal ones, so the force-fill split test should compare against a no-fee run using the same sizing rule — otherwise part of whatever gap survives will be the sizing change itself, not the fee.
The split test is the right next move — if the two silent drops cluster in the same regime, the gap risk is a property of the entry, not bad luck. One check worth adding alongside it: log the intended fill (the signal close) next to the actual open fill for every trade, and export that slippage column with the CSV. Right now the worst cost in this system is the one that never gets written down, and a strategy cannot be tuned against a cost it cannot see. If both drops share an overnight-gap signature, a filter like 'no entry when the gap exceeds X% of ATR' is a cleaner fix than touching the sizing. Happy to compare notes when you run it — this series is the most honest backtest writing I have found on here.