Position Size Calculator
Sizes a trade from the loss you accept at the stop. Units are the account balance times the risk per trade, divided by the gap between entry and stop, rounded down. The risk:reward ratio R is the distance to the target over the distance to the stop, the break-even win rate is 1 ÷ (1 + R), and the Kelly criterion, p − (1 − p) ÷ R, gives the share of the account to risk.
Enter your account balance, the share of it you are willing to lose on this trade, and the prices where you would enter, take your loss and take your profit. The calculator gives the number of shares or units to trade so that a fill at the stop loses no more than that share, along with the position's value, the loss at the stop and the gain at the target. Add the share of similar trades you expect to win and it also gives the risk:reward ratio, the win rate needed to break even, and the Kelly criterion's answer to how much of the account the trade deserves. The defaults describe a 10,000 account risking 1% on a stock bought at 50, with a stop at 48 and a target at 54, and a 40% win rate.
How the position size is worked out
A stop-loss price turns an open-ended risk into a fixed one, at least on paper. If one unit loses the distance from entry to stop, the number of units that loses a chosen amount follows directly:
units = ⌊ balance × risk % ÷ |entry − stop| ⌋
The brackets mean rounding down, to whole units or to the step you choose, so the loss at the stop never exceeds the budget. The position's value is the units times the entry price, the loss at the stop is the units times the gap to the stop, and the gain at the target is the units times the gap to the target. Because of that rounding, the share actually at risk can be smaller than the one you enter, and the table and the verdict use the share actually at risk.
The direction comes from the prices. A stop below the entry is a long trade, closed by a sell stop order; a stop above the entry is a short, closed by a buy stop order. The take-profit has to sit on the other side of the entry, or the calculator says so instead of giving a size. When the position is worth more than the balance, the leverage line shows by how much, and a short notes that short sellers are subject to margin rules.
With the defaults the budget is 1% of 10,000, or 100, and each share loses 2 between 50 and 48, a 4% fall. That gives 50 shares, a 2,500 position using a quarter of the account. A fill at the stop loses 100; a fill at the target gains 200.
Risk : reward and the break-even win rate
The ratio compares the two distances:
R = |target − entry| ÷ |entry − stop|
A trade that wins R for every 1 it risks breaks even when the wins pay for the losses, which happens at a win rate of
break-even = 1 ÷ (1 + R)
The ratio is shown to three decimals, and the break-even rate is worked from the ratio as shown. The default target 4 above a stop 2 below gives 1 : 2, so a third of such trades have to work just to stand still: 33.3%. At 1 : 1 the figure is 50% and at 1 : 3 it is 25%. A wider target lowers the bar, but only if price reaches it as often as you assume, so the win rate you enter should come from trades like this one with the same target.
Where the Kelly criterion comes from
In July 1956 J. L. Kelly Jr. published "A New Interpretation of Information Rate" in the Bell System Technical Journal. He imagined a gambler who learns the results of games over a private wire before they become common knowledge, from a channel that sometimes garbles them. Betting everything each time maximises the expected fortune, Kelly wrote, but such a gambler would be broke with probability one if he continued indefinitely. He chose instead to maximise the exponential rate of growth of the gambler's capital, and showed that a gambler betting the fraction that does so will, with probability one, eventually get ahead and stay ahead of one using any other fraction. Kelly added that the model might apply to other economic situations, as long as profits can be reinvested and the amount staked can be varied.
Edward Thorp, who first applied the idea to card counting at blackjack, set out the practical formulas in a paper presented in Montreal in 1997. For a bet that wins b units per unit staked with probability p and otherwise loses the stake, the fraction of current capital that maximises the growth rate is (bp − q) ÷ b, where q = 1 − p. His coin-tossing example wins even money 53% of the time, so the Kelly bet is 6% of capital. Betting more than about 12% in that game drives the bankroll toward zero over time, even though every bet has an edge.
Kelly applied to a trade
A trade with a fixed stop and target is the same two-outcome bet, with b = R:
f* = p − (1 − p) ÷ R
The stake in Kelly's bet is what you lose when you lose, so f* is the share of the account to risk at the stop, not the share to invest. With a 40% win rate on the default 1 : 2 trade, f* = 0.4 − 0.6 ÷ 2 = 10%. Risking 10% of 10,000 means 1,000 at the stop, which at 2 a share is 500 shares and a 25,000 position, two and a half times the account. Half Kelly risks 5%: 250 shares and 12,500. The 1% default is a tenth of full Kelly. The table shows all three sizes side by side, each with the share of the balance it actually loses at the stop.
The quantity Kelly maximised is the expected growth rate per trade, p ln(1 + Rf) + (1 − p) ln(1 − f) in natural logs. For the default trade it is 0.971% at full Kelly, 0.735% at half Kelly and 0.189% at 1%. At 20%, double the Kelly fraction, it falls to 0.070%, and at 25% it turns negative, so the account shrinks over many trades despite the edge; the verdict says so. Risking 100% means one loss at the stop wipes out the account. Thorp draws the lesson for investors: estimates of the edge are more likely to be too high than too low, so it is wise to assume the true edge is smaller and to bet less than the estimated Kelly fraction. In his continuous model half Kelly keeps three-quarters of the growth while cutting the chance of ever losing half the starting capital from 1 in 2 to 1 in 8.
A Kelly fraction of zero or below means the win rate is at or under the break-even rate. At 30% the default trade gives −5%, so the calculator shows None and says not to take it. A small positive fraction that rounds to 0% is an edge too thin to be worth taking.
What the calculator leaves out
The stop is assumed to fill at its price. The SEC's investor education site notes that a stop order becomes a market order once the stop price is reached, and that the price you get may differ from the stop, especially in a fast-moving market. A stock that opens below your stop loses more than the figure shown, and Thorp points out that a short sale's loss is potentially unlimited.
Commissions, spreads, slippage and financing are left out, so the break-even win rate is a floor. Short sellers may also pay interest on the stock loan, and must pay the lender any dividend the borrowed stock pays.
The win rate is the weakest input. Kelly's formula treats it as known, but a rate measured on a few dozen trades is a rough estimate, and Thorp warns that systems that worked in the past may owe their record partly or entirely to data mining. Real trades also have more than two outcomes: stops are moved, targets are partly filled and positions are closed early. And several positions open at once draw on the same account, so their sizes have to be judged together rather than one at a time. If you add to a position at a new price, your average cost changes and so does the distance to the stop. To judge a closed trade's result, use return on investment rather than this page.
These figures are arithmetic on the prices and win rate you enter, not a forecast or a recommendation to trade. Trading can lose more than the amount at risk shown here. See the site disclaimer.
Frequently asked questions
How many shares should I buy for a given stop-loss?
Divide the amount you are willing to lose on the trade by the loss on one share at the stop, and round down. With a 10,000 account, 1% risk, an entry at 50 and a stop at 48, the budget is 100 and each share loses 2, so the size is 50 shares, a 2,500 position. Rounding down keeps the loss at the stop at or under the budget.
What does the Kelly percentage mean for a trade?
It is the share of the account to lose if the stop is hit, not the share of the account to put into the position. With the defaults full Kelly is 10%, so 1,000 at risk. At 2 lost per share that is 500 shares, a 25,000 position, two and a half times the account, which could only be bought with margin or leverage.
What win rate do I need to break even?
One divided by one plus the reward-to-risk ratio, before costs. A 1 : 1 trade needs 50% winners, a 1 : 2 trade needs 33.3% and a 1 : 3 trade needs 25%. Commissions, spreads and stops filled at worse prices all push the real figure higher.
What does a negative Kelly percentage mean?
That the trade has no edge at the win rate you entered: on average it loses money, and the Kelly bet is nothing. With the default 1 : 2 trade a 30% win rate gives a raw Kelly figure of −5%, because 30% is below the 33.3% needed to break even. The calculator shows None for both Kelly sizes and says not to take the trade.
Why do traders use half Kelly instead of full Kelly?
Because the win rate is an estimate, and if it is too high, full Kelly overbets. In Edward Thorp's continuous model half Kelly keeps three-quarters of the growth rate while cutting the chance of ever losing half the account from 1 in 2 to 1 in 8. For the default trade half Kelly keeps 76% of full Kelly's growth per trade.
Does it work for short trades, forex and crypto?
Yes. A stop above the entry makes the trade a short, and the target then has to be below the entry. Prices can have as many decimals as a forex quote or a coin price needs, and units can be rounded down to 0.01, 0.0001 or 0.00000001 instead of whole shares. A 5,000 account risking 2% on a coin bought at 64,000 with a stop at 62,500 gets 0.06666666 units.
Sources
- A New Interpretation of Information Rate, J. L. Kelly Jr., Bell System Technical Journal, via Internet Archive, 1956
- The Kelly Criterion in Blackjack, Sports Betting, and the Stock Market, Edward O. Thorp, hosted by Occidental College, 1997
- Stop Order, Investor.gov, U.S. Securities and Exchange Commission
- Types of Orders, Investor.gov, U.S. Securities and Exchange Commission
- Stock Purchases and Sales: Long and Short, Investor.gov, U.S. Securities and Exchange Commission