Frictions and capacity: a strategy that works small can fail big

On this page
  1. Why a backtest does not see its own costs
  2. Frequency multiplies the drag
  3. Size: the same trade costs more when it is bigger
  4. Crowding: everyone leaves through the same door
  5. Traps
  6. The code
  7. Summary
  8. References

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
FrictionWhat it isGrows with
Spreadbuying at the ask and selling at the bid; half the spread is lost on each side against the midthe number of trades
Commissionthe broker’s fee per orderthe number of orders
Slippagethe gap between the price when the decision was made and the prices the order actually gotthe time between decision and fill
Market impactyour own order pushing the price against youthe size of the order against what the market can absorb
Borrow feeinterest paid to the lender of shares sold short, plus any dividends owedthe 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\risk{\text{drag a year}} \approx \text{changes a year} \times \risk{\text{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
Ticker5/20 changes a year5/20, no cost (% a year)5/20, 0.5% a change (% a year)5/20 break-even cost50/200 changes a year50/200 break-even cost
SPY12.2+16.0+9.21.21%0.912.1%
NVDA16.0+48.5+37.12.45%0.939.3%
GS14.3+14.0+6.10.91%1.99.3%
XOM18.4+4.2−5.00.22%1.210.3%
GLD16.2+8.2−0.20.49%1.94.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.418.4 times a year, so at 0.5%\risk{0.5\%} a change the formula predicts a drag of 9.2%\risk{9.2\%} a year; the rule went from +4.2%+4.2\% to −5.0%-5.0\%, a drop of exactly 9.2 points. Its break-even is 0.22%\risk{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%\risk{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%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%\risk{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.

{"panels":[{"x0":57.32,"x1":565.2,"y0":29.16,"y1":207.7,"title":"1. The 5/20 crossover on five tickers, by cost per trade","xlabel":"Cost charged per position change (% of the trade)","ylabel":"Return of the 5/20 crossover (% a year)","xlog":false},{"x0":57.32,"x1":565.2,"y0":370.73,"y1":549.28,"title":"2. A made-up rule on a made-up small stock, by fund size","xlabel":"Size of the fund (millions of dollars, log scale)","ylabel":"Profit after costs (thousands of dollars a year)","xlog":true}],"series":[{"panel":0,"label":"SPY","color":"var(--chart-maroon, #b6262c)","kind":"line","x":[0.0,0.025,0.05,0.075,0.1,0.125,0.15,0.175,0.2,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.425,0.45,0.475,0.5,0.525,0.55,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.775,0.8,0.825,0.85,0.875,0.9,0.925,0.95,0.975,1.0],"y":[16.0234,15.6706,15.3188,14.968,14.6182,14.2693,13.9214,13.5745,13.2286,12.8836,12.5396,12.1965,11.8544,11.5133,11.1731,10.8339,10.4957,10.1583,9.82196,9.48652,9.15203,8.81848,8.48586,8.15418,7.82343,7.4936,7.16471,6.83673,6.50968,6.18355,5.85833,5.53403,5.21065,4.88817,4.5666,4.24593,3.92617,3.60731,3.28935,2.97228,2.65611],"sx":[80.41,91.95,103.49,115.04,126.58,138.12,149.66,161.21,172.75,184.29,195.83,207.38,218.92,230.46,242.01,253.55,265.09,276.63,288.18,299.72,311.26,322.8,334.35,345.89,357.43,368.97,380.52,392.06,403.6,415.15,426.69,438.23,449.77,461.32,472.86,484.4,495.94,507.49,519.03,530.57,542.11],"sy":[122.35,123.28,124.2,125.12,126.04,126.96,127.87,128.78,129.69,130.59,131.49,132.39,133.29,134.18,135.08,135.97,136.85,137.74,138.62,139.5,140.38,141.25,142.13,143.0,143.86,144.73,145.59,146.45,147.31,148.16,149.02,149.87,150.72,151.56,152.41,153.25,154.09,154.92,155.76,156.59,157.42]},{"panel":0,"label":"NVDA","color":"var(--chart-blue, #3b6ea5)","kind":"line","x":[0.0,0.025,0.05,0.075,0.1,0.125,0.15,0.175,0.2,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.425,0.45,0.475,0.5,0.525,0.55,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.775,0.8,0.825,0.85,0.875,0.9,0.925,0.95,0.975,1.0],"y":[48.4594,47.8687,47.2802,46.694,46.1099,45.528,44.9483,44.3707,43.7953,43.2221,42.651,42.082,41.5151,40.9504,40.3878,39.8273,39.2689,38.7126,38.1583,37.6062,37.0561,36.5081,35.9621,35.4182,34.8763,34.3365,33.7986,33.2628,32.729,32.1973,31.6675,31.1397,30.6139,30.09,29.5681,29.0482,28.5303,28.0143,27.5002,26.9881,26.4779],"sx":[80.41,91.95,103.49,115.04,126.58,138.12,149.66,161.21,172.75,184.29,195.83,207.38,218.92,230.46,242.01,253.55,265.09,276.63,288.18,299.72,311.26,322.8,334.35,345.89,357.43,368.97,380.52,392.06,403.6,415.15,426.69,438.23,449.77,461.32,472.86,484.4,495.94,507.49,519.03,530.57,542.11],"sy":[37.27,38.82,40.37,41.9,43.44,44.96,46.48,48.0,49.51,51.01,52.51,54.0,55.49,56.97,58.45,59.92,61.38,62.84,64.29,65.74,67.18,68.62,70.05,71.48,72.9,74.32,75.73,77.13,78.53,79.93,81.32,82.7,84.08,85.46,86.83,88.19,89.55,90.9,92.25,93.59,94.93]},{"panel":0,"label":"GS","color":"var(--chart-grey, #a3a19c)","kind":"line","x":[0.0,0.025,0.05,0.075,0.1,0.125,0.15,0.175,0.2,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.425,0.45,0.475,0.5,0.525,0.55,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.775,0.8,0.825,0.85,0.875,0.9,0.925,0.95,0.975,1.0],"y":[13.9592,13.5538,13.1498,12.747,12.3457,11.9456,11.5469,11.1494,10.7533,10.3586,9.96508,9.57291,9.18203,8.79246,8.40418,8.01719,7.63148,7.24705,6.8639,6.48203,6.10142,5.72208,5.344,4.96718,4.59161,4.21729,3.84422,3.47239,3.1018,2.73244,2.36431,1.99741,1.63174,1.26728,0.904039,0.54201,0.181188,-0.178429,-0.536845,-0.894064,-1.25009],"sx":[80.41,91.95,103.49,115.04,126.58,138.12,149.66,161.21,172.75,184.29,195.83,207.38,218.92,230.46,242.01,253.55,265.09,276.63,288.18,299.72,311.26,322.8,334.35,345.89,357.43,368.97,380.52,392.06,403.6,415.15,426.69,438.23,449.77,461.32,472.86,484.4,495.94,507.49,519.03,530.57,542.11],"sy":[127.77,128.83,129.89,130.95,132.0,133.05,134.1,135.14,136.18,137.21,138.25,139.27,140.3,141.32,142.34,143.35,144.37,145.37,146.38,147.38,148.38,149.37,150.37,151.36,152.34,153.32,154.3,155.28,156.25,157.22,158.18,159.14,160.1,161.06,162.01,162.96,163.91,164.85,165.79,166.73,167.66]},{"panel":0,"label":"XOM","color":"var(--chart-purple, #7c5fd3)","kind":"line","x":[0.0,0.025,0.05,0.075,0.1,0.125,0.15,0.175,0.2,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.425,0.45,0.475,0.5,0.525,0.55,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.775,0.8,0.825,0.85,0.875,0.9,0.925,0.95,0.975,1.0],"y":[4.16303,3.68501,3.20905,2.73517,2.26334,1.79357,1.32583,0.860128,0.39645,-0.0652124,-0.524867,-0.982521,-1.43818,-1.89186,-2.34357,-2.7933,-3.24108,-3.68691,-4.13079,-4.57274,-5.01277,-5.45087,-5.88706,-6.32135,-6.75374,-7.18425,-7.61287,-8.03962,-8.46451,-8.88754,-9.30873,-9.72807,-10.1456,-10.5613,-10.9751,-11.3872,-11.7974,-12.2059,-12.6125,-13.0174,-13.4205],"sx":[80.41,91.95,103.49,115.04,126.58,138.12,149.66,161.21,172.75,184.29,195.83,207.38,218.92,230.46,242.01,253.55,265.09,276.63,288.18,299.72,311.26,322.8,334.35,345.89,357.43,368.97,380.52,392.06,403.6,415.15,426.69,438.23,449.77,461.32,472.86,484.4,495.94,507.49,519.03,530.57,542.11],"sy":[153.46,154.72,155.97,157.21,158.45,159.68,160.91,162.13,163.34,164.56,165.76,166.96,168.16,169.35,170.53,171.71,172.89,174.06,175.22,176.38,177.53,178.68,179.83,180.97,182.1,183.23,184.35,185.47,186.59,187.7,188.8,189.9,191.0,192.09,193.17,194.25,195.33,196.4,197.47,198.53,199.59]},{"panel":0,"label":"GLD","color":"var(--chart-amber, #c0781a)","kind":"line","x":[0.0,0.025,0.05,0.075,0.1,0.125,0.15,0.175,0.2,0.225,0.25,0.275,0.3,0.325,0.35,0.375,0.4,0.425,0.45,0.475,0.5,0.525,0.55,0.575,0.6,0.625,0.65,0.675,0.7,0.725,0.75,0.775,0.8,0.825,0.85,0.875,0.9,0.925,0.95,0.975,1.0],"y":[8.18216,7.74611,7.31171,6.87896,6.44784,6.01835,5.59049,5.16425,4.73963,4.31661,3.8952,3.47538,3.05716,2.64052,2.22546,1.81198,1.40007,0.98972,0.580928,0.17369,-0.232001,-0.636151,-1.03876,-1.43985,-1.8394,-2.23744,-2.63396,-3.02898,-3.42249,-3.8145,-4.20502,-4.59405,-4.9816,-5.36767,-5.75227,-6.1354,-6.51707,-6.89728,-7.27605,-7.65337,-8.02924],"sx":[80.41,91.95,103.49,115.04,126.58,138.12,149.66,161.21,172.75,184.29,195.83,207.38,218.92,230.46,242.01,253.55,265.09,276.63,288.18,299.72,311.26,322.8,334.35,345.89,357.43,368.97,380.52,392.06,403.6,415.15,426.69,438.23,449.77,461.32,472.86,484.4,495.94,507.49,519.03,530.57,542.11],"sy":[142.92,144.07,145.21,146.34,147.47,148.6,149.72,150.84,151.95,153.06,154.17,155.27,156.37,157.46,158.55,159.63,160.71,161.79,162.86,163.93,164.99,166.05,167.11,168.16,169.21,170.25,171.29,172.33,173.36,174.39,175.41,176.43,177.45,178.46,179.47,180.48,181.48,182.48,183.47,184.46,185.45]},{"panel":1,"label":"one fund trading alone","color":"var(--chart-maroon, #b6262c)","kind":"line","x":[0.05,0.0506684,0.0513457,0.0520321,0.0527276,0.0534324,0.0541467,0.0548705,0.055604,0.0563473,0.0571005,0.0578638,0.0586373,0.0594211,0.0602154,0.0610204,0.0618361,0.0626627,0.0635003,0.0643492,0.0652093,0.066081,0.0669644,0.0678595,0.0687666,0.0696859,0.0706174,0.0715614,0.072518,0.0734874,0.0744697,0.0754652,0.076474,0.0774963,0.0785322,0.079582,0.0806458,0.0817238,0.0828163,0.0839233,0.0850452,0.086182,0.0873341,0.0885015,0.0896846,0.0908834,0.0920983,0.0933294,0.094577,0.0958413,0.0971224,0.0984207,0.0997364,0.10107,0.102421,0.10379,0.105177,0.106583,0.108008,0.109452,0.110915,0.112397,0.1139,0.115423,0.116965,0.118529,0.120113,0.121719,0.123346,0.124995,0.126666,0.128359,0.130075,0.131814,0.133576,0.135361,0.137171,0.139004,0.140863,0.142745,0.144654,0.146587,0.148547,0.150533,0.152545,0.154584,0.15665,0.158744,0.160866,0.163017,0.165196,0.167404,0.169642,0.17191,0.174208,0.176536,0.178896,0.181288,0.183711,0.186167,0.188655,0.191177,0.193733,0.196323,0.198947,0.201606,0.204301,0.207032,0.2098,0.212604,0.215446,0.218326,0.221245,0.224202,0.227199,0.230236,0.233314,0.236433,0.239594,0.242796,0.246042,0.249331,0.252664,0.256041,0.259464,0.262932,0.266447,0.270009,0.273618,0.277276,0.280982,0.284738,0.288545,0.292402,0.29631,0.300271,0.304285,0.308353,0.312475,0.316652,0.320885,0.325174,0.329521,0.333926,0.33839,0.342913,0.347497,0.352142,0.356849,0.36162,0.366454,0.371352,0.376316,0.381347,0.386444,0.39161,0.396845,0.40215,0.407526,0.412973,0.418494,0.424088,0.429757,0.435502,0.441323,0.447223,0.453201,0.459259,0.465398,0.471619,0.477924,0.484313,0.490787,0.497347,0.503996,0.510733,0.51756,0.524478,0.531489,0.538594,0.545794,0.55309,0.560483,0.567976,0.575568,0.583262,0.591059,0.59896,0.606966,0.61508,0.623302,0.631634,0.640077,0.648634,0.657304,0.666091,0.674995,0.684018,0.693162,0.702428,0.711817,0.721332,0.730975,0.740746,0.750648,0.760683,0.770851,0.781155,0.791598,0.802179,0.812902,0.823769,0.834781,0.84594,0.857248,0.868707,0.88032,0.892087,0.904012,0.916097,0.928343,0.940752,0.953328,0.966072,0.978986,0.992072,1.00533,1.01877,1.03239,1.04619,1.06018,1.07435,1.08871,1.10326,1.11801,1.13296,1.1481,1.16345,1.179,1.19476,1.21073,1.22692,1.24332,1.25994,1.27678,1.29385,1.31114,1.32867,1.34643,1.36443,1.38267,1.40115,1.41988,1.43886,1.4581,1.47759,1.49734,1.51735,1.53764,1.55819,1.57902,1.60013,1.62152,1.64319,1.66516,1.68742,1.70998,1.73283,1.756,1.77947,1.80326,1.82736,1.85179,1.87654,1.90163,1.92705,1.95281,1.97891,2.00537,2.03217,2.05934,2.08687,2.11476,2.14303,2.17168,2.20071,2.23013,2.25994,2.29015,2.32076,2.35179,2.38322,2.41508,2.44737,2.48008,2.51323,2.54683,2.58087,2.61537,2.65033,2.68576,2.72167,2.75805,2.79492,2.83228,2.87014,2.9085,2.94738,2.98678,3.02671,3.06717,3.10817,3.14972,3.19182,3.23449,3.27773,3.32154,3.36594,3.41094,3.45653,3.50274,3.54956,3.59701,3.64509,3.69382,3.7432,3.79323,3.84394,3.89532,3.94739,4.00016,4.05363,4.10782,4.16273,4.21838,4.27477,4.33191,4.38982,4.4485],"y":[4.0,4.05347,4.10766,4.16256,4.21821,4.27459,4.33174,4.38964,4.44832,4.50778,4.56804,4.6291,4.69098,4.75369,4.81724,4.88163,4.94689,5.01301,5.08003,5.14793,5.21675,5.28648,5.35715,5.42876,5.50133,5.57487,5.64939,5.72491,5.80144,5.87899,5.95758,6.03722,6.11792,6.1997,6.28258,6.36656,6.45166,6.53791,6.6253,6.71387,6.80361,6.89456,6.98673,7.08012,7.17476,7.27067,7.36786,7.46636,7.56616,7.6673,7.7698,7.87366,7.97891,8.08557,8.19365,8.30318,8.41418,8.52665,8.64063,8.75614,8.87319,8.9918,9.112,9.2338,9.35723,9.48232,9.60907,9.73752,9.86769,9.9996,10.1333,10.2687,10.406,10.5451,10.6861,10.8289,10.9737,11.1203,11.269,11.4196,11.5723,11.727,11.8837,12.0426,12.2036,12.3667,12.532,12.6996,12.8693,13.0413,13.2157,13.3923,13.5714,13.7528,13.9366,14.1229,14.3117,14.503,14.6969,14.8933,15.0924,15.2942,15.4986,15.7058,15.9158,16.1285,16.3441,16.5626,16.784,17.0083,17.2357,17.4661,17.6996,17.9362,18.176,18.4189,18.6651,18.9146,19.1675,19.4237,19.6834,19.9465,20.2131,20.4833,20.7571,21.0346,21.3158,21.6007,21.8895,22.1821,22.4786,22.7791,23.0836,23.3921,23.7048,24.0217,24.3428,24.6682,24.998,25.3321,25.6708,26.0139,26.3617,26.7141,27.0712,27.433,27.7998,28.1714,28.5479,28.9296,29.3163,29.7082,30.1053,30.5077,30.9155,31.3288,31.7476,32.129,32.4515,32.7784,33.1096,33.4453,33.7854,34.1301,34.4794,34.8334,35.1921,35.5555,35.9239,36.2972,36.6754,37.0588,37.4472,37.8408,38.2397,38.644,39.0536,39.4687,39.8894,40.3157,40.7476,41.1854,41.629,42.0785,42.5341,42.9957,43.4635,43.9376,44.418,44.9048,45.3981,45.898,46.4046,46.918,47.4383,47.9655,48.4997,49.0411,49.5897,50.1457,50.709,51.2799,51.8585,52.4448,53.0389,53.641,54.2511,54.8693,55.4959,56.0872,56.5161,56.9508,57.3912,57.8376,58.2899,58.7483,59.2128,59.6835,60.1605,60.6439,61.1337,61.6301,62.1331,62.6429,63.1594,63.6829,64.2134,64.7509,65.2956,65.8477,66.4071,66.9739,67.5484,68.1305,68.7205,69.3183,69.9241,70.5379,71.16,71.7905,72.2146,72.5383,72.8664,73.1988,73.5356,73.877,74.2229,74.5734,74.9286,75.2886,75.6534,76.023,76.3976,76.7772,77.1619,77.5517,77.9468,78.3471,78.7528,79.1638,79.5804,80.0,80.0,80.0,80.0,80.0,80.0,80.0,80.0,80.0,80.0,80.0,80.0,80.0,80.0,80.0,80.0,80.0,79.8927,79.3565,78.8132,78.2626,77.7047,77.1393,76.5664,75.9858,75.3974,74.8012,74.197,73.5847,72.9643,72.3355,71.3967,70.1054,68.7968,67.4707,66.1268,64.765,63.385,61.9866,60.5695,59.1334,57.6781,56.2034,54.0634,51.7917,49.4897,47.157,44.793,42.3975,39.9699,37.5098,35.0169,32.4907,29.2409,25.7819,22.2767,18.7246,15.1251,11.4774,7.781,4.03516,0.239243,-4.50927,-9.38186,-14.3196,-19.3233,-24.3939,-29.5324,-34.7394,-40.0194,-46.4361,-52.9385,-59.5279,-66.2054,-72.9721,-79.8293,-86.7781,-94.7898],"sx":[80.41,81.77,83.14,84.51,85.87,87.24,88.6,89.97,91.34,92.7,94.07,95.43,96.8,98.17,99.53,100.9,102.26,103.63,105.0,106.36,107.73,109.09,110.46,111.83,113.19,114.56,115.92,117.29,118.66,120.02,121.39,122.75,124.12,125.49,126.85,128.22,129.58,130.95,132.32,133.68,135.05,136.41,137.78,139.15,140.51,141.88,143.24,144.61,145.98,147.34,148.71,150.07,151.44,152.81,154.17,155.54,156.9,158.27,159.64,161.0,162.37,163.73,165.1,166.47,167.83,169.2,170.56,171.93,173.3,174.66,176.03,177.39,178.76,180.13,181.49,182.86,184.22,185.59,186.96,188.32,189.69,191.05,192.42,193.79,195.15,196.52,197.88,199.25,200.62,201.98,203.35,204.71,206.08,207.45,208.81,210.18,211.54,212.91,214.28,215.64,217.01,218.37,219.74,221.11,222.47,223.84,225.2,226.57,227.94,229.3,230.67,232.03,233.4,234.77,236.13,237.5,238.86,240.23,241.6,242.96,244.33,245.69,247.06,248.43,249.79,251.16,252.52,253.89,255.26,256.62,257.99,259.35,260.72,262.09,263.45,264.82,266.18,267.55,268.92,270.28,271.65,273.01,274.38,275.75,277.11,278.48,279.84,281.21,282.58,283.94,285.31,286.67,288.04,289.41,290.77,292.14,293.5,294.87,296.24,297.6,298.97,300.33,301.7,303.07,304.43,305.8,307.16,308.53,309.9,311.26,312.63,313.99,315.36,316.73,318.09,319.46,320.82,322.19,323.56,324.92,326.29,327.65,329.02,330.39,331.75,333.12,334.48,335.85,337.22,338.58,339.95,341.31,342.68,344.05,345.41,346.78,348.14,349.51,350.88,352.24,353.61,354.97,356.34,357.71,359.07,360.44,361.8,363.17,364.54,365.9,367.27,368.63,370.0,371.37,372.73,374.1,375.46,376.83,378.2,379.56,380.93,382.29,383.66,385.03,386.39,387.76,389.12,390.49,391.85,393.22,394.59,395.95,397.32,398.68,400.05,401.42,402.78,404.15,405.51,406.88,408.25,409.61,410.98,412.34,413.71,415.08,416.44,417.81,419.17,420.54,421.91,423.27,424.64,426.0,427.37,428.74,430.1,431.47,432.83,434.2,435.57,436.93,438.3,439.66,441.03,442.4,443.76,445.13,446.49,447.86,449.23,450.59,451.96,453.32,454.69,456.06,457.42,458.79,460.15,461.52,462.89,464.25,465.62,466.98,468.35,469.72,471.08,472.45,473.81,475.18,476.55,477.91,479.28,480.64,482.01,483.38,484.74,486.11,487.47,488.84,490.21,491.57,492.94,494.3,495.67,497.04,498.4,499.77,501.13,502.5,503.87,505.23,506.6,507.96,509.33,510.7,512.06,513.43,514.79,516.16,517.53,518.89,520.26,521.62,522.99,524.36,525.72,527.09,528.45,529.82,531.19,532.55,533.92,535.28,536.65,538.02,539.38,540.75,542.11],"sy":[449.42,449.37,449.32,449.27,449.22,449.17,449.12,449.06,449.01,448.95,448.9,448.84,448.78,448.72,448.66,448.6,448.54,448.48,448.42,448.36,448.29,448.23,448.16,448.1,448.03,447.96,447.89,447.82,447.75,447.68,447.61,447.53,447.46,447.38,447.3,447.23,447.15,447.07,446.99,446.9,446.82,446.74,446.65,446.56,446.48,446.39,446.3,446.2,446.11,446.02,445.92,445.83,445.73,445.63,445.53,445.43,445.32,445.22,445.11,445.01,444.9,444.79,444.68,444.56,444.45,444.33,444.21,444.1,443.97,443.85,443.73,443.6,443.47,443.35,443.21,443.08,442.95,442.81,442.67,442.53,442.39,442.25,442.1,441.96,441.81,441.65,441.5,441.34,441.19,441.03,440.87,440.7,440.54,440.37,440.2,440.02,439.85,439.67,439.49,439.31,439.12,438.94,438.75,438.55,438.36,438.16,437.96,437.76,437.55,437.34,437.13,436.92,436.7,436.48,436.26,436.03,435.81,435.57,435.34,435.1,434.86,434.62,434.37,434.12,433.86,433.6,433.34,433.08,432.81,432.54,432.26,431.98,431.7,431.42,431.13,430.83,430.53,430.23,429.92,429.61,429.3,428.98,428.66,428.33,428.0,427.66,427.32,426.98,426.63,426.27,425.91,425.55,425.18,424.81,424.43,424.05,423.66,423.3,423.0,422.7,422.39,422.08,421.76,421.44,421.12,420.79,420.46,420.12,419.78,419.43,419.08,418.72,418.36,418.0,417.63,417.25,416.87,416.49,416.1,415.7,415.3,414.89,414.48,414.06,413.64,413.21,412.78,412.34,411.89,411.44,410.98,410.52,410.05,409.57,409.09,408.6,408.1,407.6,407.09,406.57,406.05,405.52,404.98,404.44,403.88,403.33,402.76,402.19,401.6,401.05,400.66,400.25,399.84,399.43,399.01,398.58,398.15,397.71,397.27,396.82,396.37,395.91,395.44,394.97,394.49,394.0,393.51,393.01,392.5,391.99,391.47,390.94,390.41,389.87,389.32,388.77,388.21,387.63,387.06,386.47,386.08,385.78,385.47,385.16,384.85,384.53,384.21,383.89,383.56,383.22,382.88,382.54,382.19,381.84,381.48,381.12,380.75,380.38,380.01,379.62,379.24,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.85,378.95,379.45,379.95,380.46,380.98,381.5,382.04,382.58,383.12,383.68,384.24,384.81,385.38,385.97,386.84,388.04,389.25,390.48,391.73,393.0,394.28,395.58,396.89,398.23,399.58,400.95,402.93,405.04,407.18,409.35,411.54,413.77,416.02,418.31,420.62,422.97,425.98,429.2,432.45,435.75,439.09,442.48,445.91,449.39,452.92,457.33,461.85,466.44,471.08,475.79,480.56,485.4,490.3,496.26,502.3,508.42,514.62,520.9,527.27,533.72,541.16]},{"panel":1,"label":"each of three funds trading the same signal","color":"var(--chart-blue, #3b6ea5)","kind":"line","x":[0.05,0.0506684,0.0513457,0.0520321,0.0527276,0.0534324,0.0541467,0.0548705,0.055604,0.0563473,0.0571005,0.0578638,0.0586373,0.0594211,0.0602154,0.0610204,0.0618361,0.0626627,0.0635003,0.0643492,0.0652093,0.066081,0.0669644,0.0678595,0.0687666,0.0696859,0.0706174,0.0715614,0.072518,0.0734874,0.0744697,0.0754652,0.076474,0.0774963,0.0785322,0.079582,0.0806458,0.0817238,0.0828163,0.0839233,0.0850452,0.086182,0.0873341,0.0885015,0.0896846,0.0908834,0.0920983,0.0933294,0.094577,0.0958413,0.0971224,0.0984207,0.0997364,0.10107,0.102421,0.10379,0.105177,0.106583,0.108008,0.109452,0.110915,0.112397,0.1139,0.115423,0.116965,0.118529,0.120113,0.121719,0.123346,0.124995,0.126666,0.128359,0.130075,0.131814,0.133576,0.135361,0.137171,0.139004,0.140863,0.142745,0.144654,0.146587,0.148547,0.150533,0.152545,0.154584,0.15665,0.158744,0.160866,0.163017,0.165196,0.167404,0.169642,0.17191,0.174208,0.176536,0.178896,0.181288,0.183711,0.186167,0.188655,0.191177,0.193733,0.196323,0.198947,0.201606,0.204301,0.207032,0.2098,0.212604,0.215446,0.218326,0.221245,0.224202,0.227199,0.230236,0.233314,0.236433,0.239594,0.242796,0.246042,0.249331,0.252664,0.256041,0.259464,0.262932,0.266447,0.270009,0.273618,0.277276,0.280982,0.284738,0.288545,0.292402,0.29631,0.300271,0.304285,0.308353,0.312475,0.316652,0.320885,0.325174,0.329521,0.333926,0.33839,0.342913,0.347497,0.352142,0.356849,0.36162,0.366454,0.371352,0.376316,0.381347,0.386444,0.39161,0.396845,0.40215,0.407526,0.412973,0.418494,0.424088,0.429757,0.435502,0.441323,0.447223,0.453201,0.459259,0.465398,0.471619,0.477924,0.484313,0.490787,0.497347,0.503996,0.510733,0.51756,0.524478,0.531489,0.538594,0.545794,0.55309,0.560483,0.567976,0.575568,0.583262,0.591059,0.59896,0.606966,0.61508,0.623302,0.631634,0.640077,0.648634,0.657304,0.666091,0.674995,0.684018,0.693162,0.702428,0.711817,0.721332,0.730975,0.740746,0.750648,0.760683,0.770851,0.781155,0.791598,0.802179,0.812902,0.823769,0.834781,0.84594,0.857248,0.868707,0.88032,0.892087,0.904012,0.916097,0.928343,0.940752,0.953328,0.966072,0.978986,0.992072,1.00533,1.01877,1.03239,1.04619,1.06018,1.07435,1.08871,1.10326,1.11801,1.13296,1.1481,1.16345,1.179,1.19476,1.21073,1.22692,1.24332,1.25994,1.27678,1.29385,1.31114,1.32867,1.34643,1.36443,1.38267,1.40115,1.41988,1.43886,1.4581,1.47759,1.49734,1.51735,1.53764,1.55819,1.57902],"y":[4.0,4.05347,4.10766,4.16256,4.21821,4.27459,4.33174,4.38964,4.44832,4.50778,4.56804,4.6291,4.69098,4.75369,4.81724,4.88163,4.94689,5.01301,5.08003,5.14793,5.21675,5.28648,5.35715,5.42876,5.50133,5.57487,5.64939,5.72491,5.80144,5.87899,5.95758,6.03722,6.11792,6.1997,6.28258,6.36656,6.45166,6.53791,6.6253,6.71387,6.80361,6.89456,6.98673,7.08012,7.17476,7.27067,7.36786,7.46636,7.56616,7.6673,7.7698,7.87366,7.97891,8.08557,8.19365,8.30318,8.41418,8.52665,8.64063,8.75614,8.87319,8.9918,9.112,9.2338,9.35723,9.48232,9.60907,9.73752,9.86769,9.9996,10.1333,10.2687,10.406,10.5451,10.6812,10.7883,10.8969,11.0069,11.1184,11.2314,11.3459,11.4619,11.5795,11.6986,11.8194,11.9417,12.0657,12.1913,12.3187,12.4477,12.5784,12.7109,12.8452,12.9812,13.1191,13.2589,13.4004,13.5439,13.6893,13.8367,13.986,14.1373,14.2906,14.446,14.6035,14.763,14.9247,15.0886,15.2547,15.4229,15.5934,15.7662,15.9414,16.1188,16.2986,16.4809,16.6655,16.8526,17.0423,17.2344,17.4292,17.6265,17.8265,18.0291,18.2345,18.4426,18.6535,18.8004,18.9447,19.091,19.2393,19.3895,19.5418,19.6961,19.8524,20.0109,20.1714,20.3341,20.499,20.6661,20.8354,21.007,21.1808,21.357,21.5356,21.7165,21.8999,22.0857,22.274,22.4648,22.6581,22.8541,23.0526,23.2539,23.4578,23.6644,23.8738,24.043,24.1505,24.2595,24.3699,24.4818,24.5951,24.71,24.8265,24.9445,25.064,25.1852,25.308,25.4324,25.5585,25.6863,25.8157,25.9469,26.0799,26.2147,26.3512,26.4896,26.6298,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.6667,26.5001,26.3196,26.1368,25.9514,25.7637,25.5734,25.3805,25.1851,24.987,24.7863,24.583,24.3769,24.168,23.9128,23.4839,23.0492,22.6088,22.1624,21.7101,21.2517,20.7872,20.3165,19.8395,19.3561,18.8663,18.2215,17.467,16.7024,15.9275,15.1423,14.3466,13.5403,12.7232,11.8952,11.0561,10.0521,8.90319,7.73892,6.55909,5.36348,4.15189,2.92411,1.67991,0.419083,-1.07325,-2.6917,-4.33179,-5.9938,-7.67803,-9.38477,-11.1143,-12.867,-14.9051,-17.0649,-19.2536,-21.4715,-23.7191,-25.9968,-28.3048,-30.8622,-33.6274,-36.4296,-39.2693,-42.1469,-45.063],"sx":[80.41,81.77,83.14,84.51,85.87,87.24,88.6,89.97,91.34,92.7,94.07,95.43,96.8,98.17,99.53,100.9,102.26,103.63,105.0,106.36,107.73,109.09,110.46,111.83,113.19,114.56,115.92,117.29,118.66,120.02,121.39,122.75,124.12,125.49,126.85,128.22,129.58,130.95,132.32,133.68,135.05,136.41,137.78,139.15,140.51,141.88,143.24,144.61,145.98,147.34,148.71,150.07,151.44,152.81,154.17,155.54,156.9,158.27,159.64,161.0,162.37,163.73,165.1,166.47,167.83,169.2,170.56,171.93,173.3,174.66,176.03,177.39,178.76,180.13,181.49,182.86,184.22,185.59,186.96,188.32,189.69,191.05,192.42,193.79,195.15,196.52,197.88,199.25,200.62,201.98,203.35,204.71,206.08,207.45,208.81,210.18,211.54,212.91,214.28,215.64,217.01,218.37,219.74,221.11,222.47,223.84,225.2,226.57,227.94,229.3,230.67,232.03,233.4,234.77,236.13,237.5,238.86,240.23,241.6,242.96,244.33,245.69,247.06,248.43,249.79,251.16,252.52,253.89,255.26,256.62,257.99,259.35,260.72,262.09,263.45,264.82,266.18,267.55,268.92,270.28,271.65,273.01,274.38,275.75,277.11,278.48,279.84,281.21,282.58,283.94,285.31,286.67,288.04,289.41,290.77,292.14,293.5,294.87,296.24,297.6,298.97,300.33,301.7,303.07,304.43,305.8,307.16,308.53,309.9,311.26,312.63,313.99,315.36,316.73,318.09,319.46,320.82,322.19,323.56,324.92,326.29,327.65,329.02,330.39,331.75,333.12,334.48,335.85,337.22,338.58,339.95,341.31,342.68,344.05,345.41,346.78,348.14,349.51,350.88,352.24,353.61,354.97,356.34,357.71,359.07,360.44,361.8,363.17,364.54,365.9,367.27,368.63,370.0,371.37,372.73,374.1,375.46,376.83,378.2,379.56,380.93,382.29,383.66,385.03,386.39,387.76,389.12,390.49,391.85,393.22,394.59,395.95,397.32,398.68,400.05,401.42,402.78,404.15,405.51,406.88,408.25,409.61,410.98,412.34,413.71,415.08,416.44,417.81,419.17,420.54,421.91,423.27,424.64,426.0,427.37,428.74,430.1,431.47,432.83,434.2,435.57],"sy":[449.42,449.37,449.32,449.27,449.22,449.17,449.12,449.06,449.01,448.95,448.9,448.84,448.78,448.72,448.66,448.6,448.54,448.48,448.42,448.36,448.29,448.23,448.16,448.1,448.03,447.96,447.89,447.82,447.75,447.68,447.61,447.53,447.46,447.38,447.3,447.23,447.15,447.07,446.99,446.9,446.82,446.74,446.65,446.56,446.48,446.39,446.3,446.2,446.11,446.02,445.92,445.83,445.73,445.63,445.53,445.43,445.32,445.22,445.11,445.01,444.9,444.79,444.68,444.56,444.45,444.33,444.21,444.1,443.97,443.85,443.73,443.6,443.47,443.35,443.22,443.12,443.02,442.92,442.81,442.71,442.6,442.49,442.39,442.27,442.16,442.05,441.93,441.82,441.7,441.58,441.46,441.33,441.21,441.08,440.96,440.83,440.69,440.56,440.43,440.29,440.15,440.01,439.87,439.72,439.58,439.43,439.28,439.13,438.97,438.82,438.66,438.5,438.33,438.17,438.0,437.83,437.66,437.49,437.31,437.13,436.95,436.77,436.58,436.4,436.21,436.01,435.82,435.68,435.55,435.41,435.27,435.13,434.99,434.85,434.7,434.56,434.41,434.26,434.1,433.95,433.79,433.63,433.47,433.31,433.14,432.97,432.8,432.63,432.45,432.28,432.1,431.92,431.73,431.54,431.35,431.16,430.97,430.81,430.71,430.61,430.51,430.4,430.3,430.19,430.08,429.97,429.86,429.75,429.64,429.52,429.4,429.29,429.17,429.04,428.92,428.79,428.67,428.54,428.41,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.37,428.53,428.7,428.87,429.04,429.21,429.39,429.57,429.75,429.93,430.12,430.31,430.5,430.7,430.93,431.33,431.73,432.14,432.56,432.98,433.4,433.83,434.27,434.71,435.16,435.62,436.22,436.92,437.63,438.35,439.08,439.82,440.56,441.32,442.09,442.87,443.8,444.87,445.95,447.05,448.16,449.28,450.42,451.58,452.75,454.13,455.64,457.16,458.7,460.27,461.85,463.46,465.09,466.98,468.98,471.02,473.08,475.16,477.28,479.42,481.8,484.37,486.97,489.6,492.28,494.98]}]} 2026-11-08T05:20:38.665158 image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/ 0.0 0.2 0.4 0.6 0.8 1.0 Cost charged per position change (% of the trade) −10 0 10 20 30 40 50 Return of the 5/20 crossover (% a year) 1. The 5/20 crossover on five tickers, by cost per trade SPY NVDA GS XOM GLD 0.1 0.3 1 3 Size of the fund (millions of dollars, log scale) −100 −75 −50 −25 0 25 50 75 Profit after costs (thousands of dollars a year) 2. A made-up rule on a made-up small stock, by fund size one fund trading alone each of three funds trading the same signal
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%\good{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\key{\text{net profit a year}} = \text{round trips a year} \times (\good{\text{edge}} - \risk{\text{cost}}) \times \text{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
FundOrder (shares)Share of a day’s volumeLast fill from the midCost per round tripNet per round tripNet a year
$100,0005,0001%1 cent0.10%+0.40%+8.0% ($8,000)
$1 million50,00010%3 cents0.18%+0.32%+6.4% ($64,000)
$10 million500,000100%25 cents1.30%−0.80%−16.0% (−$1.6 million)
$100 million5,000,0001,000%250 cents12.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%\risk{0.10\%} a round trip. At $1 million it is a tenth of the day and pays 0.18%\risk{0.18\%}, still well under the 0.5%\good{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%\key{8.0\%} at $100,000 and 6.4%\key{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\key{\usd 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%\risk{0.43\%} instead of 0.18%\risk{0.18\%}, and each keeps $14,667\key{\usd 14{,}667} a year instead of $64,000\key{\usd 64{,}000}. In Figure 1 the three-fund line peaks at about $27,000\key{\usd 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 thinkActually
A positive backtest means a positive live strategythe 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 tradethe spread is; impact grows with the size of the order against the market
More trades means more profiteach 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 sizethe 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 negativethe return falls from the first extra dollar; profit in dollars peaks well before it turns negative
Splitting a big order removes the impactit trades impact for slippage while the price moves
Other funds on the same trade confirm itthey 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
VariableHolds
pxadjusted closes, one column per ticker
pos1 on the days the rule holds the ticker, 0 on cash days
changes1 on each day the position changes, the days that pay the cost
round_tripthe made-up book’s cost of buying and selling a fund’s order, as a share of the price
import pandas as pd

url = "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) / 252

for 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 sides
def 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 price

for 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.

The script behind the real numbers

The tables and the chart come from examples/frictions-and-capacity-small-can-fail-big/capacity.py, which runs on the blog’s five tickers. To run it yourself, clone the examples repo: its README has a three-command Docker setup, or run uv run frictions-and-capacity-small-can-fail-big/capacity.py.

Summary

Table 6 collects the ideas, with the number behind each.

Table 6. Six ideas about frictions and capacity, with the numbers from this post
IdeaIn one lineThe number behind it
Frictionsspread, commission, slippage, impact and borrow fee; a backtest at the close pays none of themfive rows, each growing with something different
Cost dragchanges a year times cost per changeXOM’s 5/20 rule: 18.4 times 0.5% is 9.2 points a year
Break-even costthe cost per trade that wipes out the gain0.22% for XOM’s 5/20 rule, 10.3% for its 50/200
Impactgrows with the order against the market’s volume; spread and commission do notmade-up round trip: 0.10% at 1% of a day, 1.30% at 100%
Capacitythe size past which more money stops payingmade-up rule: dollars peak near 2 million, zero near 3.6 million
Crowdingfunds on the same trade share its capacity and exit togetherthree 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.
Tagged finance, trading, backtesting, costs← Home