5D Library › Regime-Switching Fractional Kelly, Maximum-Drawdown Constraints and Lifecycle Leverage Allocation · 中文

Chapter 5. Ralph Vince’s Optimal f: Kelly in Trader’s Units, and Its Drawdowns

What optimal f is

Ralph Vince’s optimal f, popular among futures traders since 1990, sizes positions from a list of past trade results (Vince 1990). Each trade’s holding-period return at fraction ff is 1+ft/B1 + f \, t / B, where tt is the trade’s profit and BB the largest loss in the list; the trader holds one contract for every B/fB/f dollars of equity. Optimal f maximizes the geometric mean of these returns. This is the Kelly criterion applied to the empirical distribution of trades, with the bet measured in units of the largest loss; Vince’s contribution was the practical bookkeeping, and he himself warned that trading at the optimum brings deep drawdowns. p09 uses an illustrative list of 20 trades.

Calculation

# Chapter 5. p09: Ralph Vince's optimal f on an illustrative list of 20
# trade results (dollars per contract). Holding period return of a
# trade t at fraction f is 1 + f * t / B, B the largest loss (300): one
# contract is traded for every B / f dollars of equity. Optimal f
# maximizes the geometric mean; TWR is the product over the list.
# Drawdowns at each f are measured on 2,000 sequences of 100 trades
# drawn from the list with replacement, seed 98.
import random
from math import exp, log

TRADES = (250, -100, 80, -150, 400, -120, -90, 60, 300, -200,
          150, -80, -110, 500, -60, 90, -140, 70, -300, 220)
B = -min(TRADES)

def g(f):
    return sum(log(1 + f * t / B) for t in TRADES) / len(TRADES)

def argmax(fun, lo, hi):
    for _ in range(100):
        a, b = lo + (hi - lo) / 3, hi - (hi - lo) / 3
        lo, hi = (a, hi) if fun(a) < fun(b) else (lo, b)
    return (lo + hi) / 2

def max_dd(seq, f):
    w = peak = 1.0
    dd = 0.0
    for t in seq:
        w *= 1 + f * t / B
        peak = max(peak, w)
        dd = max(dd, 1 - w / peak)
    return dd

if __name__ == "__main__":
    fo = argmax(g, 0.0, 0.999)
    lo, hi = fo, 0.999
    for _ in range(100):
        mid = (lo + hi) / 2
        lo, hi = (mid, hi) if g(mid) > 0 else (lo, mid)
    print("   mean trade {:.1f}, largest loss {}".format(
        sum(TRADES) / 20, B))
    print("   optimal f {:.3f}: one contract per {:.0f} dollars".format(
        fo, B / fo))
    print("   growth turns negative above f = {:.3f}".format(lo))
    rng = random.Random(98)
    seqs = [[rng.choice(TRADES) for _ in range(100)] for _ in range(2000)]
    print("   f       f/opt  TWR(20)  median MDD  P(MDD>=50%)")
    for k in (0.25, 0.5, 1.0, 1.5, 2.0):
        f = k * fo
        dd = sorted(max_dd(s, f) for s in seqs)
        print("   {:.3f}  {:5.2f}  {:7.2f}  {:10.3f}  {:11.3f}".format(
            f, k, exp(20 * g(f)), dd[1000],
            sum(d >= 0.5 for d in dd) / 2000))
#    mean trade 38.5, largest loss 300
#    optimal f 0.300: one contract per 999 dollars
#    growth turns negative above f = 0.594
#    f       f/opt  TWR(20)  median MDD  P(MDD>=50%)
#    0.075   0.25     1.18       0.259        0.019
#    0.150   0.50     1.33       0.468        0.407
#    0.300   1.00     1.45       0.760        0.976
#    0.450   1.50     1.32       0.918        1.000
#    0.601   2.00     0.98       0.983        1.000

The list has a mean profit of 38.5 dollars and a largest loss of 300; optimal f is 0.300, one contract for every 999 dollars. Growth turns negative above f = 0.594, almost exactly twice the optimum, the same “twice Kelly” boundary as in Chapter 1. On resampled sequences of 100 trades the median maximum drawdown at the optimum is 0.760, and a drawdown of half or more happens with chance 0.976. Half of optimal f keeps a TWR of 1.33 against 1.45 over the 20 trades, with a median drawdown of 0.468; a quarter keeps 1.18 with 0.259.

Optimal f from a short record

The deeper problem is the list itself. p10 treats the 20 trades as the whole population and gives each of 4,000 traders a record of 30 trades drawn from it.

Calculation

# Chapter 5. p10: Optimal f estimated from a short record. Treat the 20
# trades of p09 as the whole population. A trader sees 30 trades drawn
# from it, computes optimal f and the largest loss of that sample, and
# then trades the next 100 trades with that sizing (contracts per
# dollar = f / largest loss), or with half of it. Sizes are reported
# relative to the true optimum (0.300 / 300). 4,000 traders, seed 98.
import random
from math import log

TRADES = (250, -100, 80, -150, 400, -120, -90, 60, 300, -200,
          150, -80, -110, 500, -60, 90, -140, 70, -300, 220)

def opt_f(sample):
    b = -min(sample)
    if b <= 0:
        return 0.999, 1.0
    def g(f):
        return sum(log(1 + f * t / b) for t in sample)
    lo, hi = 0.0, 0.999
    for _ in range(80):
        x, y = lo + (hi - lo) / 3, hi - (hi - lo) / 3
        lo, hi = (x, hi) if g(x) < g(y) else (lo, y)
    return (lo + hi) / 2, b

def grow(seq, size):
    w = 1.0
    for t in seq:
        w = max(w * (1 + size * t), 0.0)
    return w

if __name__ == "__main__":
    rng = random.Random(98)
    true_size = 0.300 / 300
    rel, missed = [], 0
    out = {"true": [], "estimated": [], "half": []}
    for _ in range(4000):
        f, b = opt_f([rng.choice(TRADES) for _ in range(30)])
        size = f / b
        missed += b < 300
        rel.append(size / true_size)
        fut = [rng.choice(TRADES) for _ in range(100)]
        out["true"].append(grow(fut, true_size))
        out["estimated"].append(grow(fut, size))
        out["half"].append(grow(fut, size / 2))
    rel.sort()
    q = lambda v, a: v[int(a * (len(v) - 1))]
    print("   estimated size / true size: 10% {:.2f}, median {:.2f},"
          " 90% {:.2f}".format(q(rel, 0.1), q(rel, 0.5), q(rel, 0.9)))
    print("   share sized above 2 x true: {:.3f}".format(
        sum(r > 2 for r in rel) / 4000))
    print("   share whose sample missed the -300 loss: {:.3f}".format(
        missed / 4000))
    print("   sizing        median TWR(100)  10th pct  share losing money")
    for k in ("true", "estimated", "half"):
        v = sorted(out[k])
        print("   {:<12}  {:15.2f}  {:8.3f}  {:18.3f}".format(
            k, q(v, 0.5), q(v, 0.1), sum(x < 1 for x in v) / 4000))
#    estimated size / true size: 10% 0.00, median 1.03, 90% 2.28
#    share sized above 2 x true: 0.150
#    share whose sample missed the -300 loss: 0.209
#    sizing        median TWR(100)  10th pct  share losing money
#    true                     6.29     0.537               0.173
#    estimated                1.75     0.034               0.252
#    half                     2.31     0.966               0.110

The median trader sizes about right (1.03 times the true optimum), but the spread is enormous: a tenth size at zero because their sample shows no edge, a tenth size at 2.28 times the optimum or more, and 0.150 size at more than twice it. A sample of 30 trades missed the largest loss with chance 0.209, and a trader whose record lacks the worst trade sizes from a smaller BB.

Trading the next 100 trades, the true optimum gives a median TWR of 6.29; the estimated optimum only 1.75, with a tenth percentile of 0.034 and a chance of losing money of 0.252. Half of the estimated optimum does better on every measure that matters for survival: median 2.31, tenth percentile 0.966, chance of loss 0.110. When the optimum must be estimated, a fraction of it is not timidity but the better bet.

Hypothesis · not established

The author’s interpretation (not yet tested): traders who size by optimal f computed from their own records of fewer than fifty trades end with lower terminal equity than traders who use half of that size. What would show it wrong: in a broker’s records of systematic futures accounts, accounts sized at the full estimated optimal f have higher median equity after one hundred trades than accounts at half of it, with no higher rate of closure.

Summary

Optimal f is Kelly in trader’s units, and inherits both of Kelly’s properties: growth is lost at twice the optimum, and drawdowns of half or more are routine at the optimum itself. Estimated from 30 trades, it is so uncertain that half of the estimate grows faster in the median and loses money far less often.

References

Vince, Ralph. 1990. Portfolio Management Formulas: Mathematical Trading Methods for the Futures, Options, and Stock Markets. John Wiley & Sons.

Fan, Y. (2026). Regime-Switching Fractional Kelly, Maximum-Drawdown Constraints and Lifecycle Leverage Allocation: Cyclical Drift Estimation Errors, Ruin-Bounded Bet Sizing and Human-Capital Amortization [体制转换分数凯利、最大回撤约束与生命周期杠杆配置] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090256 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).