The what a trade costs post priced a single trade: the spread, the
walk up the order book, the commission, the fee to borrow a share for a short sale. This post
asks what happens to those costs when a rule trades more often, and when the same rule runs
with more money. The first question has a real answer on the blog’s five tickers (SPY, NVDA, GS,
XOM, GLD, January 2020 to October 2025). The second needs trading volume and order books, which
the price file does not have, so it is worked on a made-up stock with every made-up number
labelled as one. The arithmetic is the same either way: an edge per trade, a cost per trade, and
how many trades.
Why a backtest does not see its own costs
Romero and Balch list four parts of a backtest in chapter 14 of
What Hedge Funds Really Do: the
historical data, the strategy, an analysis engine, and a market simulator of which they write:
“Ideally, it should include transactions costs such as commissions, as well as market impact
costs (the effect on a stock’s market price of increased trading volume caused by our
strategy).” The word “ideally” is doing work. The backtesting post built a simulator that fills at the
close, and the execution chapter of the CFA Institute’s
Handbook of Artificial Intelligence and Big Data Applications in Investments
says what such a simulator misses: on historical prices, simulated trades “do not generate any
market impact, because neither do they take away liquidity in the book nor can they cause any
other market participant to react to the trade”. A backtest trades in a market that does not
notice it.
The gap between that market and the real one is the frictions. They are not one cost, and
they do not grow with the same thing (Table 1).
Table 1. Five frictions and what makes each one bigger
Friction
What it is
Grows with
Spread
buying at the ask and selling at the bid; half the spread is lost on each side against the mid
the number of trades
Commission
the broker’s fee per order
the number of orders
Slippage
the gap between the price when the decision was made and the prices the order actually got
the time between decision and fill
Market impact
your own order pushing the price against you
the size of the order against what the market can absorb
Borrow fee
interest paid to the lender of shares sold short, plus any dividends owed
the time the short is held
The CFA chapter defines slippage the same way, as “the difference between a reference price
before the start of the trade and the prices at which trades are executed”, and notes that for
an order that crosses the spread “half the spread is lost with every trade relative to the
mid-price”, even if the mid never moves. Romero and Balch (chapter 4) describe the short seller
paying “interest to the owner of the shares borrowed”, which they call the rebate, “as well as
any dividends to which the owner is entitled during the borrowing period”. That last row is the
odd one: it is charged by time held, not by trade, so a slow rule that holds its shorts for
months pays it in full. The other four are charged per trade, and two of them, the spread and
the commission, do not care how big the trade is. Impact does.
Frequency multiplies the drag
Ernest Chan puts the first
rule in one line (chapter 2): “The more frequent it trades, the larger the impact of transaction
costs will be on the profitability of the strategy.” A rule that is either fully in or fully out
pays one cost each time it changes position, so its yearly cost drag is close to a product:
drag and cost per change, what trading takes
drag a year≈changes a year×cost per change
The SMA cross post counted the crossovers of two pairs of moving averages on
SPY: 71 for the fast 5-day and 20-day pair, four for the slow 50 and 200. Here both run as rules
on all five tickers, holding the ticker while the fast average is above the slow one and cash
otherwise, with yesterday’s signal setting today’s position. Each position change pays a cost;
the slow pair’s count includes its first buy, which is not a cross. Table 2 has the result as a
compound return a year.
Table 2. The 5/20 and 50/200 crossovers by ticker, January 2020 to October 2025
Ticker
5/20 changes a year
5/20, no cost (% a year)
5/20, 0.5% a change (% a year)
5/20 break-even cost
50/200 changes a year
50/200 break-even cost
SPY
12.2
+16.0
+9.2
1.21%
0.9
12.1%
NVDA
16.0
+48.5
+37.1
2.45%
0.9
39.3%
GS
14.3
+14.0
+6.1
0.91%
1.9
9.3%
XOM
18.4
+4.2
−5.0
0.22%
1.2
10.3%
GLD
16.2
+8.2
−0.2
0.49%
1.9
4.2%
The break-even cost is the cost per change at which the rule’s whole gain over the period is
gone. XOM’s fast rule changed position 18.4 times a year, so at 0.5% a change the
formula predicts a drag of 9.2% a year; the rule went from +4.2% to −5.0%, a drop
of exactly 9.2 points. Its break-even is 0.22%, about twice the full spread of the
costs post’s toy book, so a rule that looked fine on paper is one wide spread away from losing
money. The slow pair on the same stock survives a cost of 10.3% a change, because it
paid it only seven times in nearly six years.
NVDA’s fast rule survives everything in the table, but not because trading often is safe. NVDA
compounded at 83.3% a year held and left alone; any rule that was in the market for part of
that run had a large gain to pay costs from. The cheapest test of a fast rule is the one in
Figure 1’s first panel: draw the return against the cost per trade and see where each line
crosses zero. Two of the five cross before 0.5%.
The edge has to be measured per trade, because the cost is charged per trade. XOM’s fast
rule earned 4.2% a year from 18.4 trades a year, about 0.23% a trade, and that is the number to
hold up against the spread.
Figure 1. Fast crossover by cost per trade; made-up rule by fund size
The same arithmetic is why the alphas post found its
one-day reversal formulas untradeable on five names: a signal that flips with each day’s move
trades nearly every day, and a tiny edge per trade has nothing left after the spread.
Size: the same trade costs more when it is bigger
The spread and the commission are the same percentage for an order of 100 shares and one of
10,000. Market impact is not. The CFA chapter opens with the reason a bigger fund pays more:
“larger trades are required to change positions for funds with higher assets under management,
and the larger a trade is, the more impact it tends to have on market prices.” Chan (chapter 2)
adds that impact “can contribute to a large part of the total transaction cost when the security
is not very liquid”, and gives the practical limit (chapter 5): “each order should not exceed 1
percent of the average daily volume”. His example is a small-cap stock of the time trading about
51,000 shares a day at $4.45, where 1% of the volume is “just 510 shares, which are worth only
$2,269!”
The price file has no volume, so here is a made-up stock to show the mechanism. Every number in
this section is made up:
The stock’s mid price is $20.00, with 20,000 shares waiting at every cent above and below it,
so the best ask is $20.01 and the best bid $19.99.
It trades 500,000 shares, 10 million dollars, on an average day.
The rule earns 0.5% before costs on each round trip, a buy and a later sell, and makes
20 round trips a year.
A market order walks the book as in the costs post and Romero and Balch’s chapter 4: the first
20,000 shares fill one cent from the mid, the next 20,000 two cents away, and so on. The book is
assumed to refill before the next order, which is generous.
Under those assumptions the yearly profit is:
net profit, what the fund keepsedge, what the rule earns per round trip before costscost per round trip, which grows with the order
net profit a year=round trips a year×(edge−cost)×fund size
The edge does not change with the fund’s size. The cost does, because a bigger fund sends a
bigger order into the same book (Table 3).
Table 3. The made-up rule at four fund sizes
Fund
Order (shares)
Share of a day’s volume
Last fill from the mid
Cost per round trip
Net per round trip
Net a year
$100,000
5,000
1%
1 cent
0.10%
+0.40%
+8.0% ($8,000)
$1 million
50,000
10%
3 cents
0.18%
+0.32%
+6.4% ($64,000)
$10 million
500,000
100%
25 cents
1.30%
−0.80%
−16.0% (−$1.6 million)
$100 million
5,000,000
1,000%
250 cents
12.55%
not one order: ten days of volume
At $100,000 the order sits exactly at Chan’s 1% and pays only the spread, 0.10% a
round trip. At $1 million it is a tenth of the day and pays 0.18%, still well under the
0.5% edge: the rule is real. At $10 million the order is the whole day’s volume, the
last share fills 25 cents above the mid, and the cost is more than twice the edge. At $100
million the order would push the price from $20.00 towards $22.50 on the way in and back down
on the way out; there is no rule left to run.
Capacity is the name for where this happens. Chan defines it twice: “how much a strategy can
absorb without negatively impacting its returns” (chapter 2), and “the amount of equity a
strategy can generate good returns on” (chapter 8), adding that “It is far, far easier to
generate a high Sharpe ratio trading a $100,000 account than a $100 million account.”
Figure 1’s second panel draws the made-up rule over every fund size. The return a year falls from
the first extra dollar, 8.0% at $100,000 and 6.4% at $1 million, because each
dollar added makes every trade a little more expensive. The dollars a year keep rising for a
while, since a smaller percentage of a bigger fund is still more money: they peak at about
$80,000 a year near $2 million, then fall, and cross zero near $3.6 million. Past
that point every new dollar costs the fund money, including the dollars that were there first.
Capacity belongs to the rule and the market together, not to the backtest. The same rule on
the same prices is a good strategy at one size and a losing one at four times that size, and
a backtest that fills at the close shows the same return for both.
Real funds do not send a day’s volume as one market order. The CFA chapter describes the usual
answer: the order is “split into smaller slices that are then executed over the available time
horizon”, trading the price impact against “the risk of the price moving unfavorably over the
execution horizon”. Chan (chapter 5) names what that costs: splitting “will certainly reduce
market impact; however, it engenders another kind of transactions costs, namely, slippage.”
How a large order is sliced is the subject of the series’ post on execution. For capacity the
point is that slicing moves the cost from impact to slippage; it does not make it go away.
Crowding: everyone leaves through the same door
The made-up book has one more lesson. Suppose three funds of $1 million each run the same rule
and send the same order at the same moment. The book does not know there are three of them; it
sees one order of 150,000 shares. Each fund’s round trip now costs 0.43% instead of
0.18%, and each keeps $14,667 a year instead of $64,000. In
Figure 1 the three-fund line peaks at about $27,000 near $0.6 million and crosses zero
near $1.2 million: in this model three equal funds share one capacity, so each gets a third of
it.
That is crowding, and the sources describe it in three steps:
Others find the same trade. Romero and Balch (chapter 2) warn that “intense competition
among hedge funds and major Wall Street institutions can rapidly erode the effectiveness of any
strategy”. Chan (chapter 4) gives the small-scale version: a proprietary trading firm that sees your
profitable strategy may “piggyback” on it with its own capital, “In this case, your strategy will suffer more market
impact trading cost as time goes on.”
Their positions converge. Chan (chapter 8) notes that funds chasing the same inefficiency
“may still end up holding very similar positions”.
They leave together. In chapter 6 he retells August 2007, when a number of quantitative
funds lost heavily in the same week, Goldman Sachs’s Global Alpha fund “falling 22.5 percent”.
The mechanism he gives is that a large loss makes one fund sell large positions; “If other hedge
funds are holding similar positions, they will then suffer large losses also”, and their own
risk systems sell in turn. His summary in chapter 8: “a stampede out of similar losing positions
can (and did) cause a complete meltdown of the market.”
The exit is where crowding bites, because it is the moment when everyone needs the other side of
the book at once. Romero and Balch (chapter 4) note that “widening spreads can be an early
indication of a market whose liquidity is freezing up”, as in the fixed income markets in the
fall of 2008. Their case study of Long-Term Capital Management (chapter 15) adds leverage: its
price gaps “might be very small, so profits mandated that high volumes be traded, using borrowed
money”, and when they widened instead of closing, lenders issued margin calls “demanding that
LTCM liquefy positions, regardless of losses”. If spreads widen as liquidity freezes, a capacity
worked out from calm-market costs overstates what a crowded exit can carry.
Traps
Table 4 has the beliefs this post set out to correct.
Table 4. Seven beliefs about frictions and capacity and what is actually true
People think
Actually
A positive backtest means a positive live strategy
the backtest’s market never reacts to its orders; a rule needs its edge per trade above its cost per trade
Cost is a fixed percentage per trade
the spread is; impact grows with the size of the order against the market
More trades means more profit
each trade pays the cost; XOM’s 5/20 rule went from +4.2% to −5.0% a year at 0.5% a change
A strategy that makes 8% makes 8% at any size
the made-up rule makes 8.0% at $100,000, 6.4% at $1 million and loses at $10 million
Capacity is where the return turns negative
the return falls from the first extra dollar; profit in dollars peaks well before it turns negative
Splitting a big order removes the impact
it trades impact for slippage while the price moves
Other funds on the same trade confirm it
they share its capacity, and they will want to sell when you do
The code
The snippet reproduces the 5/20 rows of Table 2 and the cost and net columns of Table 3; Table 5
names its variables.
Table 5. Variables in the frictions snippet
Variable
Holds
px
adjusted closes, one column per ticker
pos
1 on the days the rule holds the ticker, 0 on cash days
changes
1 on each day the position changes, the days that pay the cost
round_trip
the made-up book’s cost of buying and selling a fund’s order, as a share of the price
import pandas as pdurl = "https://raw.githubusercontent.com/ankurtrapasiya/examples/main/data/prices.csv"px = pd.read_csv(url, index_col="date", parse_dates=True)r = (px / px.shift(1) - 1).dropna()years = len(r) / 252for t in px.columns: fast, slow = px[t].rolling(5).mean(), px[t].rolling(20).mean() pos = (fast > slow).astype(float).shift(1).reindex(r.index).fillna(0) # 1 = hold today changes = pos.diff().abs().fillna(0) # 1 on each trade for cost in (0.0, 0.005): net = pos * r[t] - changes * cost # every trade pays the cost a_year = (1 + net).prod() ** (1 / years) - 1 # compound return a year print(f"{t} {changes.sum() / years:4.1f} trades a year, cost {cost:.1%}: {a_year:+.1%} a year")# made-up book: mid $20.00, 20,000 shares waiting at every cent on both sidesdef round_trip(fund, price=20.0, depth=20_000): shares = fund / price full, rest = divmod(shares, depth) cents = depth * full * (full + 1) / 2 + rest * (full + 1) # walk the book, level by level return 2 * cents * 0.01 / shares / price # buy and sell, as a share of the pricefor fund in (100_000, 1_000_000, 10_000_000): cost = round_trip(fund) print(f"${fund:>10,}: round trip {cost:.2%}, a year {20 * (0.005 - cost):+.1%}")
It prints, for each ticker, 12.2 to 18.4 trades a year and the return a year without costs and at
0.5% a trade (XOM +4.2% and −5.0%), then the made-up round trips: 0.10%, 0.18% and 1.30%, and
+8.0%, +6.4% and −16.0% a year. .shift(1) makes today’s position use yesterday’s signal, and
divmod(shares, depth) returns how many price levels the order empties completely and how many
shares are left for the next one.
Table 6 collects the ideas, with the number behind each.
Table 6. Six ideas about frictions and capacity, with the numbers from this post
Idea
In one line
The number behind it
Frictions
spread, commission, slippage, impact and borrow fee; a backtest at the close pays none of them
five rows, each growing with something different
Cost drag
changes a year times cost per change
XOM’s 5/20 rule: 18.4 times 0.5% is 9.2 points a year
Break-even cost
the cost per trade that wipes out the gain
0.22% for XOM’s 5/20 rule, 10.3% for its 50/200
Impact
grows with the order against the market’s volume; spread and commission do not
made-up round trip: 0.10% at 1% of a day, 1.30% at 100%
Capacity
the size past which more money stops paying
made-up rule: dollars peak near 2 million, zero near 3.6 million
Crowding
funds on the same trade share its capacity and exit together
three funds of 1 million: 64,000 dollars a year each becomes 14,667
References
Philip J. Romero and Tucker Balch, What Hedge Funds Really Do: An Introduction to Portfolio
Management (Business Expert Press, 2014). Chapter 14 for the
four parts of a backtest and the market simulator that should include commissions and market
impact; chapter 4 for the market spread, widening spreads as a sign of freezing liquidity, the
order book walk and the short seller’s interest and dividends; chapter 2 for competition eroding
a strategy; chapter 15 for Long-Term Capital Management’s small price gaps, leverage and margin
calls.
Ernest P. Chan, Quantitative Trading: How to Build Your Own Algorithmic Trading Business
(Wiley, 2009). Chapter 2 for transaction costs growing with trading frequency, market impact in
illiquid stocks and the first definition of capacity; chapter 4 for a strategy’s impact cost
rising when others piggyback on it; chapter 5 for the 1% of average daily volume rule, the
small-cap example and splitting orders trading impact for slippage; chapter 6 for August 2007
and the contagion between funds holding similar positions; chapter 8 for capacity, the
$100,000 against $100 million comparison and the stampede out of similar positions.
CFA Institute Research Foundation, Handbook of Artificial Intelligence and Big Data
Applications in Investments (2023). Chapter 8 for slippage against a
reference price, larger funds needing larger trades with more impact, slicing an order over a
time horizon, half the spread lost per marketable order, and historical-price simulators
generating no market impact.