Sub topic 10
Trading costs and taxes
This chapter assumes you know the following:
- What a capital gain is (selling for more than you paid).
- How compounding works.
- How to read a short Python function.
The previous chapters covered why timing is hard to forecast and why it needs two correct decisions. This chapter covers a separate problem. Even a timer who is right more often than not pays a toll each time they act. Costs and taxes set a bar the timer must clear before any skill shows up as profit.
Why costs belong in the timing argument
Staying invested requires almost no transactions. A timer needs at least two trades per cycle, one to exit and one to re-enter. Every trade has a price, and some trades create a tax bill. Both reduce the amount that keeps compounding.
The effect is easy to underestimate because each item looks small. A 0.1% cost or a 15% tax rate does not sound alarming. The damage comes from three facts:
- The costs repeat with every cycle.
- Tax is paid on the full gain, not only on the part you traded.
- The money lost to tax and costs can no longer compound.
The direct costs of trading
Trading costs fall into four groups.
| Cost | What it is | Typical size for liquid index funds |
|---|---|---|
| Commission | A fee charged by the broker per trade | Often zero at large retail brokers, but not everywhere |
| Bid-ask spread | The gap between the price buyers offer and sellers ask. You buy at the ask and sell at the bid | A few hundredths of a percent for large ETFs, more for small or foreign funds |
| Market impact and slippage | The price moves while your order fills | Small for retail orders, larger in fast, thin markets |
| Fund-level fees | Purchase or redemption fees, or short-term trading fees some mutual funds charge | Zero to a couple of percent, depending on the fund |
Slippage matters for timers in particular. Timers tend to trade during turmoil, which is when spreads widen and prices gap. The calm-market cost figure understates what an exit during a panic actually costs.
Direct costs are the smaller part of the problem for most investors in broad index funds. Taxes are usually larger.
Taxes: the larger drag
In a taxable account, selling an asset at a gain triggers a tax on that gain. The rules differ by country. The example below uses the general shape of US rules, which many other systems resemble. Check your own jurisdiction before relying on any number here.
- Gains on assets held one year or less are short-term. They are taxed like ordinary income, at rates that can be 30% or more.
- Gains on assets held longer than one year are long-term. They are taxed at lower rates, commonly 0%, 15% or 20%.
- Losses can offset gains, and some losses can offset a limited amount of ordinary income.
- If you buy the same or a nearly identical security within 30 days before or after selling at a loss, the US "wash sale" rule disallows the loss for now.
A buy-and-hold investor can defer all tax until the sale, possibly decades away. The deferral is valuable in itself. The tax you have not yet paid stays invested and compounds for you.
A timer who exits during a decline and re-enters later usually realizes gains that would otherwise be deferred. Because the exit often follows a period of profit, many of those gains are short-term or at least taxed earlier than they would have been.
A worked comparison
The function below compares two investors who both earn the same 7% price return each year for ten years on 10,000 units of money. One holds for ten years and pays a 15% long-term rate once at the end. The other sells and re-buys every year, paying a 30% short-term rate on each year's gain. The code ignores spreads and fees, so it shows only the tax effect.
def after_tax_value(start, annual_return, years, tax_rate, sell_every_year):
value = start
basis = start
for _ in range(years):
value *= 1 + annual_return
if sell_every_year:
value -= max(value - basis, 0) * tax_rate
basis = value # re-bought at the new, lower value
if not sell_every_year:
value -= max(value - basis, 0) * tax_rate
return value
holder = after_tax_value(10_000, 0.07, 10, 0.15, sell_every_year=False)
trader = after_tax_value(10_000, 0.07, 10, 0.30, sell_every_year=True)
print(round(holder), round(trader))The holder ends with about 18,200 and the trader with about 16,100. Both earned identical pre-tax returns. The trader's effective yearly return fell from 7% to about 4.9% (7% × 0.70), and that gap compounds for ten years.
This setup is deliberately generous to the trader, because it assumes the trades did not change the pre-tax return. A real timer is also trying to beat the market, so the comparison should be read as the hurdle the timer's skill must clear.
The break-even question
Costs turn the timing question into a quantitative one. How much better must the timer's decisions be, before costs, to match the holder after costs? You can estimate this for a single exit and re-entry.
def breakeven_edge(round_trip_cost, tax_rate, gain_fraction):
"""Pre-tax return the timer must add to match a holder.
round_trip_cost: spread and fees for exit plus re-entry, as a fraction
tax_rate: tax rate applied to the realized gain
gain_fraction: realized gain as a fraction of the amount sold
"""
tax_cost = tax_rate * gain_fraction
return round_trip_cost + tax_cost
# 0.2% round-trip cost, 30% tax, position is 40% gain
print(round(breakeven_edge(0.002, 0.30, 0.40), 3)) # 0.122With a modest 0.2% round-trip cost, a 30% rate and a position that is 40% gain, the timer must avoid about 12 percentage points of loss just to break even on a single cycle. Tax drives that figure. The small direct cost barely moves it. The size of the gain you realize matters more than the number of trades.
This is a simplification. The holder also pays tax eventually, so the real gap is the deferral benefit rather than the whole tax bill. The code is an upper bound that shows direction and order of magnitude, not an exact figure.
Where costs and taxes matter less
The argument is strongest in a taxable account. It weakens in three cases:
- Tax-advantaged accounts. In accounts such as a 401(k), IRA or an ISA-type wrapper, selling inside the account usually triggers no tax. Taxes then drop out, and only direct costs and the other timing problems remain.
- Positions with losses. Selling at a loss creates a tax asset. Deliberate loss harvesting, selling a loser and buying a similar but not identical fund, is a rules-based use of taxes, not market timing.
- Large, rarely traded spreads. In very liquid funds the spread is tiny. The direct cost argument is weak there, and the tax argument carries the weight.
Common errors
- Counting only commissions. Zero-commission trading removes one fee. It does not remove spreads, slippage or taxes.
- Using the long-term rate for frequent trading. Frequent traders mostly realize short-term gains, which are taxed at higher rates.
- Forgetting that cash earns taxable interest. Time spent out of the market usually earns interest, but that interest is normally taxed as income.
- Ignoring the wash sale rule. Selling at a loss and re-buying the same fund within the window can cancel the tax benefit you expected.
- Applying one country's rules everywhere. Rates, holding periods and loss rules differ widely.
Exercise
An investor in a taxable account has a position worth 50,000 with a cost basis of 30,000. They sell during a downturn and re-buy a week later. Assume a 25% tax rate on the gain and a combined 0.2% round-trip trading cost. About how much do they lose to tax and costs on this single cycle, and what does that mean for the timing decision?
Show answer
The realized gain is 50,000 − 30,000 = 20,000, so tax is 0.25 × 20,000 = 5,000. Trading costs are 0.002 × 50,000 = 100. The total is about 5,100, or roughly 10.2% of the position, before any consideration of whether the exit was well timed. The market would have to fall by more than about 10% during the week out of the position, and the investor would have to re-enter near the low, just to break even. Part of the tax is a deferral rather than a permanent loss, because a holder would pay tax on this gain eventually. Even so, the amount of capital that stops compounding in the meantime is large.
Exercise
Name two situations where the tax argument against trading is weaker, and say why.
Show answer
First, inside a tax-advantaged retirement account, where selling usually triggers no tax, so only direct costs and forecasting difficulty remain. Second, when the position is sold at a loss, because the loss can offset other gains or income, subject to rules such as the wash sale rule. In both cases the tax bill that makes timing expensive is small or absent.