Kelly criterion formula (calculator ) for traders to use

Here you can use a Kelly criterion formula calculator to calculate the optimal fraction and best possible return. Lots of explanation is provided to help patrons understand the formula better. Kelly criterion, Kelly formula, Kelly criterion calculator

Kelly criterion formula calculator

Here is the Kelly criterion calculator for traders to use. Each and every time before any trade, try it to determine how much to invest and or check out the probable return. Also bookmark this page for future use.,

How to use the Kelly criterion calculator

Your winning odds p, if p=60%, then put 0.60, is the probability of selling your stocks at the targeted increased price W. If W=65%. then input 0.65. The losing odds q (q=1-p) will be calculated automatically, which is the probability you will sell your stock at the price set up for stop-loss. If you are willing to take a 20% loss or L=0.20, then write in 0.20. Try it. F should be 2.3846 while R should be 0.3532.


Your Winning odds p
Your Losing odds q
Your Winning fraction W
Your Losing fraction L



Interpretation of F and R

F is the optimal fraction you should invest in order to gain the optimal return R. F=0 or negative means you should invest nothing. If F=0.20, it means you should invest 20% of all your cash in your account. When F>1, for instance, F=2.3846, then you should invest 138.46% more than you have (you only have 100%), which you have to borrow from somewhere, often from your broker as a margin loan).

When R=0.3532, your cash account is expected to increase by 35.32% if you invest the optimal fraction. When R<0, that means you lose money.

An example of calculation

I estimate that I have a 65% chance (0.65) for me to sell my stock at the targeted price which is increased by 30% (0.30) -the winning fraction based on the amount I trade. On the other hand, I estimate that I have a 35% (0.35) chance to have to sell my stock at the price set at a 15% decreased price (0.15).
I use the calculator and find F=3.1667, which means that I should invest 316.67% of what I have for the transaction. I only have 100%, so I need to borrow 216.67% from a broker as a margin loan.
Also find R= 0.2319, which means that theoretically it is probable that my return can be 23.19%.
Specifically, if I have $1000 cash in my account, I will need to borrow $2166.70 and invest a total of $3166.7. When my position gets sold, it is likely that my return will be $0.2319x1000 (note that it is based on $1000 not $3166.7), which is net $231.89 profit. The theoretical increase in price when I sell my position is 231.89/3166.7 = 0.0732 or 7.32% increase based on the transaction. For a particular transaction, it is unlikely I will see this number. But if this case repeats 100 times, then the average return can be close to this number.
Remember that all the calculation is for one transaction only.

About Kelly criterion formula

Kelly criterion formula is a mathematical formula created by Dr. John Larry Kelly in 1956, who earned his PhD in physics from the University of Texas at Austin, which is to address the optimal amount of bet a gambler should wager considering the risk involved in the betting. The common sense is that you should bet less when the risk is high and vice versus. When the risk is high enough you should not bet anything at all. So there is an optimal amount that yields the best outcome. The Kelly formula is useful also for traders of any sort in determining how much they should invest in order to have their return or profit maximized.

Factors considered in the Kelly formula and what the formula can tell a trader

The factors the so-called Kelly criterion formula considers include:

1) The winning odds p. This is the probability of winning a bet ( for stock trading, the bet is the expected or targeted price. Say the starting price is $1.00 and the investor expects the price to increase by 20%, that is, $1.20 at the probability of p.), the winning odds p can be anything between 0 and 1. The higher the odds, the more likely the trader is going to win.

2) The losing odds q. This is the probability of losing a bet (for stock trading, the losing odds means the probability of losing the bet at a specific losing price. Let us say the starting price is $1.00 and the trader would accept the loss when the price drops 10% to $0.90. The losing odds is the probability that the trader has to sell the stock at the expected losing position). The losing odds q can be calculated by subtracting 1 by the winning odds p, which is 1-p. It is between 0 and 1. The higher q is, the more likely the trader is going to lose..

3) The fraction of the bet expected to gain at the probability p - the winning fraction W. Say, if the price is expected to increase to $1.30 from $1.00 at the winning probability, then the winning fraction W is 0.30 or 30%.

4) Likewise, the fraction of the bet expected to lose at the probability q -the losing fraction L. Say, if the price is expected to drop to 0.80 or 20% from $1.00 at the losing odds, then the losing fraction L is 0.20 or 20%.

The formula can be used to predict the optimal fraction of your total cash available to you (F) and the possible return (R).

Mathematical expression of Kelly criterion formula

Optimal fraction F= p/L - q/W

For example, if p=0.60 (60% probability to get the target price), q=1-p=0.40 (40% chance to lose the bet at the acceptable losing price), L=0.20 (the trader accepts to lose 20% drop if he has to), W=0.30 (the expected price increase-40%, that is, if the starting price is $1.00, he expects the price to rise to $1.40, a 40% increase.

Then the optimal fraction F=0.60/0.20 - 0.40/0.30 = 1.66667.

This means that the trader can best the return by using 166.6667% of cash available to him.

Particularly in this case, the factors are very much in favor of the trader, a better probability to win, a higher price increase to expect, you can use more than what in his trading account. This is where the margin loan comes into play. The trader has only 100% to expend. He needs to borrow a margin loan to maximize the outcome for this transaction. For instance, if he has $100 in his account, he should borrow $66.7 as a margin loan to invest a total of $166.70 to best the outcome.

(In the USA, a trader may be only qualified to borrow a margin loan when he has $25,000 in his cash account. Some international brokers may not follow the rule. When the trader has $2000 in his account, his broker may lend 4x or 6x as much his cash as a margin loan)

So what is the actual probable return?

The Kelly criterion formula is not just to show you how much you should transact. It also predicts the probable return.

The formula for the return is as follows:

R=(1 + FW)p · (1 - FL)q - 1

In the above case, R=0.04887, which means that the return is an increase by 4.887% of the trader's total account. He starts with $100. And he borrows $66.70 from his broker as a margin loan, makes a $166.70 worth transaction and he potentially increases the value of his account to $104.88.

F=0 means that the trader should not invest anything. In this case, the trader has nothing to gain and nothing to lose and keep whatever in his cash account intact. Nonoptimal R can be smaller than 0 like -0.20 meaning that he loses 20% of his cash account.

Comment on Kelly criterion formula

Although Kelly criterion formula gives the trader a favorable prediction in this case, it is extremely dangerous to use a margin loan. There is nothing wrong with the formula. It is just that the optimal fraction and return is based on a theory of probability. That is, a trader may lose all his capital before he is able to make a comeback to make a profit.

Probability is such that the trader is not 100% certain that he will win or lose a particular transaction. In reality, he could lose multiple trades in a row, which could wipe out his cash quickly. Trade moderately is the keywords to remember. This is like you are okay with cold or flu, but try not to get cancer! Many traders cannot wait to make a million of dollars. So they invest a lot for a transaction which carries a risk that is too high for them to tolerate. Warren Buffett once said one man may get 10 women pregnant in a month, but he cannot have a baby in just one month, meaning it needs time to build your wealth. When the risk cannot be managed or controlled, your investment is a form of gambling.

That is why using a margin is very dangerous and most brokers are monitoring the transactions by a margin borrower and if they see the risk is too high, they may place a margin call to force the trader to sell off his position or not allow the position to be kept overnight to minimize their risk of losing capital.

Beginner day traders should start with small transactions. Remember that they are learning to do the business, not to make a lot of money at the beginning of their stock trading venture. For that reason, they actually should practice with fake money with a simulator. This is not just about the risk from the transaction itself. The risk from a large volume transaction can implicate the trader's psychology and impacts his execution of his trading, which induce another risk that the Kelly criterion formula does not address. For instance, when a trader buys $100,000 worth stocks for a transaction, the risk of losing thousands of dollars could be too high for most retail traders. When the loss occurred, the trader could lose his mind and he may do a unwise movement which can worsen the outcome.

There are a lot of more to understand the Kelly criterion formula.

Derivation of Kelly criterion formula

Less mathematically, the return of an investment (R) can be expressed by the following formula:

R=(1 + FW)p · (1 - FL)q - 1 (1)

F - the fraction used to conduct a transaction of all cash available in the trader's account. If 25% of all cash is used to buy a stock, then F=0.25.

W - the % increase in price (if it is 40%, then W in the formula is 0.40) when the stock gets sold at the expected or targeted price which has a probability of p.

L - the % loss of the investment (if it is 20%, then L in the formula is 0.20) when the stock gets sold at the acceptable price when price drops, which has a probability of q.

p - the probability of selling the stock at the increased price. It ranges between 0 and 1.

q - the probability of selling the stock at the decreased price. It ranges between 1 and o.


Take the natural logarithm of equation 1, equation 1 becomes

lnR=p ln(1+FW) + q ln(1-FL) (2)

When dlnR/dF = 0, lnR reaches its maxima. When lnR is maximal, then R is also maximal.

That is, pW/(1+FW) + qL/(1-FL) = 0.

Resolve the equation, yielding F = p/L - q/W (3)

In this equation, F value is the fraction that makes the return R reach its maximum. F is determined by p, q, W, and L.

This is the Kelly criterion formula. Literally it says when you know your odds of winning p, your odds to lose q, how much you expect to win W when you win, and how much you are willing to lose L when you lose, the F determined by the equation 3 is the optimal fraction you can use to invest in order to have the maximal return.

More details about Kelly criterion formula

Interested readers can read a page about Kelly Criterion to have more understanding of the formula.

Cited from Wikipedia

This graph shows the expected value of different betting fractions. The game in this example is for a coin flip win-or-lose, with the coin weighted to win 60% of the time. The optimal bet, called the Kelly bet, is 20% of the bankroll. Over time, on average, each round will increase the bankroll by 2.03%. Betting less than 20% will have a lower average return, e.g. betting 10% will provide an average 1.5% increase. Betting over 38% percent will result in losing money over time.

Formula: r = (1 + fb)p · (1 - fa)q - 1