The Kelly criterion gives the bet size that maximizes long-run logarithmic growth of a bankroll — f* = W − (1−W)/R, from your win rate and payoff ratio. This guide derives the number, shows a Pine Script v6 calculator, and then spends equal time on the part most calculators omit: your win rate is an estimate from a finite sample, not a fact, and estimation error makes full Kelly systematically too aggressive — which is why practitioners from Thorp onward use fractional Kelly. Educational material only, not financial advice: no position-sizing formula creates an edge where none exists, and trading carries a real risk of loss.
The Kelly criterion says: risk the fraction of your account given by *f\ = W − (1 − W) / R*, where W is your probability of winning a trade and R is your average win divided by your average loss. For example, with a 45% win rate and winners averaging 1.8× the size of losers, f\ = 0.45 − 0.55 / 1.8 ≈ 0.144, or about 14.4% of the account on a single trade. If f\* comes out at or below zero, Kelly's answer is blunt: the edge is non-positive — the correct bet is nothing.
Two things about that example deserve immediate attention. First, 14.4% per trade is enormous by any practical risk standard — an early hint that full Kelly, applied naively to trading, is far more aggressive than it first appears. Second, and more fundamental: the formula's output is only as good as W and R, and in trading those are estimates from a finite sample of past trades, not known probabilities. A coin has a knowable 50%; your strategy's true win rate is something you infer, with error bars, from history that may not resemble the future.
The formula itself comes from the general form f\ = (bp − q)/b for a bet paying b-to-1 with win probability p and loss probability q = 1 − p; substituting R for b and W for p gives the trading version above. What it optimizes is specific and worth stating precisely: the expected logarithm of wealth — the long-run compound growth rate — over an infinite sequence of independent, identically distributed bets. Every one of those italicized conditions fails to some degree in real markets, which is why the second half of this article is about shrinking* the number the calculator gives you, not celebrating it.
The criterion originates with John L. Kelly Jr., a physicist at Bell Labs, in his 1956 paper "A New Interpretation of Information Rate" (Bell System Technical Journal). Kelly, building on Claude Shannon's information theory, asked how a gambler with a private information channel should size bets to maximize the long-run growth rate of capital — and showed the answer is to maximize the expected logarithm of wealth, which yields the fraction above. Betting to maximize expected wealth in dollars, by contrast, tells you to stake everything every time, which almost surely ruins you; the logarithm is what encodes the compounding reality that losses hurt more than equal-sized gains help.
The idea moved from theory to practice through Edward Thorp, who used Kelly sizing for blackjack in Beat the Dealer (1962) and later applied it to markets, including in his hedge fund Princeton Newport Partners and his widely read paper "The Kelly Criterion in Blackjack, Sports Betting, and the Stock Market." The academic case for and against is collected in The Kelly Capital Growth Investment Criterion (MacLean, Thorp and Ziemba, 2011), which is the standard reference if you want the full derivations and the debates. In the trading literature, Ralph Vince's "optimal f" is a closely related formulation computed from a strategy's actual trade distribution rather than the binary win/loss model.
Under its assumptions, Kelly has genuinely remarkable properties: it asymptotically outgrows any substantially different strategy, and it never risks total ruin on a single bet (the fraction is always below 1 when losses are bounded). But the same mathematics contains a sharp warning that most calculators leave out: growth as a function of bet size is a curve that peaks at f\ and then falls — under the standard continuous approximation, betting twice* Kelly drives the expected growth rate to zero, and beyond that it turns negative. Overbetting is not merely riskier; past a point, it is expected to lose, even with a real edge.
Here is the argument that matters more than the formula. Suppose your backtest or trade journal shows 45% winners over 50 trades. The standard error of a proportion is √(W(1−W)/n) — for W = 0.45 and n = 50 that is about ±7 percentage points for a single standard error. Your "45% win rate" is honestly "somewhere around 38% to 52%, probably." Now watch what that does to Kelly: at W = 0.45, R = 1.8, f\ ≈ 14.4%; at W = 0.38 with the same R, f\ = 0.38 − 0.62/1.8 ≈ 3.6%. Within one standard error of your measurement, the "optimal" bet drops by a factor of four — and if the true rate is 38% while you bet 14.4%, you are staking roughly four times true Kelly, which the previous section showed is deep in negative-expected-growth territory.
This asymmetry is the crux: the penalty for overbetting is far worse than the penalty for underbetting. Bet half of true Kelly and you give up some growth; bet double and you expect to grind toward zero. Since estimation error means you never know true Kelly, and since the error hurts catastrophically in one direction and mildly in the other, the rational response is to shade down — hard.
Trading adds violations the coin-toss model never had. Outcomes are not binary (wins and losses form a distribution with fat tails; a single outsized loss breaks the W/R summary). Trades are not independent (regimes cluster). The distribution is not stationary (the market that generated your sample is not the market you trade tomorrow). And if your W and R come from a backtest rather than live trades, they are likely inflated by overfitting to begin with — a topic our overfitting and deflated-Sharpe articles treat in depth. Every one of these pushes in the same direction: the real optimal fraction is below what the formula prints.
The standard practitioner response is fractional Kelly: compute f\ and then bet a fixed fraction of it — half Kelly (0.5 × f\) or quarter Kelly (0.25 × f\). This is not timidity; it is the mathematically sensible reaction to input uncertainty, and it has an attractive trade-off built in. Under the usual continuous (Gaussian) approximation, betting a fraction k of Kelly achieves about 2k − k² of the full-Kelly growth rate — so half Kelly captures roughly 75% of the growth* while cutting the variance of the wealth path roughly in half. You give up a modest slice of theoretical growth for a dramatically smoother ride and a fat margin of safety against having overestimated your edge. Thorp himself has written that he and others typically operated at fractional Kelly for exactly these reasons.
There is a neat way to see why this works: if your true edge is uncertain, betting half of estimated Kelly keeps you at-or-below true Kelly across a wide range of estimation errors. Quarter Kelly extends that buffer further — appropriate when the inputs come from a small sample, a backtest, or a strategy that has not seen a full range of market regimes, which describes nearly everyone reading this.
Concretely, with the earlier numbers (W = 0.45, R = 1.8, f\ ≈ 14.4%): half Kelly is ~7.2% per trade and quarter Kelly is ~3.6%. Note that even quarter Kelly sits above the 1–2% per-trade risk that common money-management guidance suggests — a useful sanity check in both directions. When Kelly says your edge supports 14% and your gut says 1%, the honest reconciliation is usually that you do not trust your W and R very much. That distrust is correct, and the position size should reflect it. Kelly is best used not as a dial to turn risk up, but as a ceiling you deliberately stay well beneath — and as a detector: if f\ ≤ 0, no sizing scheme rescues the strategy.
Here is a compact, compilable Pine v6 indicator that computes full and fractional Kelly from your inputs and displays them in a table on the chart. It is a calculator, not a signal generator — it plots nothing and trades nothing:
//@version=6
// Educational only — validate before trading; not financial advice.
// Kelly inputs are ESTIMATES: treat the output as a ceiling, not a target.
indicator("Kelly fraction calculator", overlay = false)
winRate = input.float(45.0, "Win rate (%)", minval = 1.0, maxval = 99.0) / 100.0
payoff = input.float(1.8, "Avg win / avg loss (R)", minval = 0.01)
fraction = input.float(0.25, "Kelly fraction used", minval = 0.05, maxval = 1.0)
kelly = winRate - (1.0 - winRate) / payoff
usedRisk = math.max(kelly, 0.0) * fraction
var table t = table.new(position.top_right, 2, 3, border_width = 1)
if barstate.islast
table.cell(t, 0, 0, "Full Kelly")
table.cell(t, 1, 0, str.tostring(kelly * 100.0, "#.##") + "%")
table.cell(t, 0, 1, "Fractional Kelly (" + str.tostring(fraction) + "x)")
table.cell(t, 1, 1, str.tostring(usedRisk * 100.0, "#.##") + "%")
table.cell(t, 0, 2, "Edge positive?")
table.cell(t, 1, 2, kelly > 0 ? "yes" : "NO — Kelly says do not bet")Mechanical notes: the script uses indicator() because it only displays information; every built-in is namespaced (input.float, math.max, str.tostring, table.new); and the negative-edge case is handled explicitly — math.max(kelly, 0.0) ensures a losing configuration reports 0% rather than a nonsensical negative size.
Before you type numbers in, be honest about where they come from. If W and R are backtest outputs, run the sample-size arithmetic from earlier and consider how much overfitting may have flattered them — our position-sizing, expectancy, and risk-of-ruin articles form the rest of this cluster and cover those estimates' failure modes. This calculator, and this article, are educational only and not financial advice. The Kelly criterion sizes an edge; it cannot detect or create one. A win rate measured from the past is an estimate, not a fact, and trading always carries a real risk of loss.
Educational only — not financial advice. Trading involves substantial risk of loss.