Size Matters – Kelly Optimization

The formula

When you have >50% chance to win in a game, how much money would you bet each time? If you bet 100% of your money, you may lose it all just because of bad luck; if you bet 1% every time, your capital could grow so slow that the game is not worth playing. According to Kelly Optimization Model (the original Kelly paper), the relationship between the probability of winning p and the optimal bet size f is:

— — — — — — — — — — — — — — — — —   GEEK ZONE  — — — — — — — — — — — — — — — — — — — —


— — — — — — — — — — — — — — — — —   GEEK ZONE  — — — — — — — — — — — — — — — — — — — —

A Quick Example

In this game, you put your bet and blindly pick one card out of a deck. If you got a spade, you would lose 100% of your bet; if you got anything else, you would gain 100%. So no matter how much you bet for each game, you either double it or lose it all. Theoretically, your expected return,  (1 / 4) * (-100%) + (3 / 4) * 100% = 50%, is in your favour. But in real world, if you lose all your money in just one game, you wouldn’t have any equity left to enjoy the infinite 50%s in the future.

To find out the optimal allocation in R:

f <- seq(0, 1, 1/1000)
test <- rep(1, 1000)
test[which(rbinom(1000, 1, 1/4) == 1)] <- -1
gain <- function(f) prod(1 + f * test)
rets <- sapply(f, gain)
plot(f, rets, type = 'l')

The test shows the optimal allocation that maximizes your total return in the long-run is 50%, which equals to the result by using Kelly:  3 /4 * 2 – 1 = 50%.

An Implementation

To find out if Kelly can help improve investment strategies, I plugged it into a RSI(14)50/50 model. The RSI(14) indicator, measures oversold and overbought with a percentage number, makes itself a good proxy for the chance to win (p in Kelly formula).

Note: Reminded by friend Mark Leeds, I noticed this implementation actually doesn’t meet all pre-conditions required by Kelly Criterion. Kelly Criterion is only applicable with a binomial outcome between 100% and -100% like in the example above. This implementation ignores that the gain/loss in trading is a variable that is proportional to initial investments. Although this test seems effective (probably because in this test the investor assumes he’s in a much more risky environment than he really is), the Kelly formula should be substituted by Optimal f (found in this journal) here.

And to better illustrate the effects brought by Kelly.

As shown above, Kelly strategy has the same winning rate as RSI(14) but much less volatile returns. By implementing this bet sizing strategy, we effectively reduced our exposure to the fat-tail risk of RSI(14).



4 thoughts on “Size Matters – Kelly Optimization

  1. hi:your study is interesting is a but I don’t think it’s correct because your p is NOT probability of winning X ( with (1-p) the probability of losing X ) . it’s the prob of oversold or overbought. So, I’m pretty certain it’s a mis-use of kelly even though the use of it reduces the volatility. To use the framework of kelly for trading, you would need to use the results of Ralph Vince related to optimal f. ( see his website for the paper that explains optimal f ). People have issue with using optimal f also but atleast it’s an attempt to dealing the problems of applying the kelly criterion to trading. Still, thanks for the study. It made me think.


    • Hi Mark. Thanks for commenting and sharing a great source of knowledge.
      Sorry for causing confusion by not providing enough assumptions in my post,but I believe this study is similar to the “special case” that mentioned in Ralph’s article. Firstly, it assumes each trade is a coin tossing experiment with a head/tail ratio defined by RSI(14) (this is probably where the confusion comes from. In my understanding, RSI measures the strength of oversold/overbought so it could be used to measure the success rate of each mean-reversion bet); second, it conflates long/short by reversing RSI(14) when short-selling. (e.g. when RSI = 70%, go short, p = 70%; when RSI = 30, go long, p = 1 – 30%).
      Hopefully that’s a good explanation. Please let me know if you need more clarification.


      • hi roy: it’s good to meet you and thanks for your reply. it’s been a while since I looked at kelly or optimal f but, in your example, you’re not betting X and then either losing X or winning X. that’s what kelly assumes, namely that , when you bet, it’s winner takes all. let me know if this is clear or my understanding of your setup is wrong etc.

        another way of saying it is that, when you’re wrong about oversold or overbought,
        you only lose the amount lost when you reverse but it’s not ( necessarily ) equal to the amount you bet. kelly assumes that it is.


      • hi mark. if I understand correctly, the thing concerns you is that in a “neat” Kelly model, bet returns should always be 100% or -100%, which is not the case in the test. I totally agree on that level (as you can see in my quick example). But this test assumes the market is subject to random walk (please forgive me again for not saying it in the post), which means the outcome (W) is unknown for each trade. Given the market doesn’t fit in any type of known distributions, you could win or lose anywhere between 0% and 99.99% any time of the day. I believe what makes you feel wrong is my attempt to use the model in a heavy “fog of war”, but in a day trading test, it’s inappropriate to include the pay-off of each trade in the model, otherwise it would be a time-travel mistake.
        that said, you did point out a subtle but important issue that I was not aware of before. I’ll put a headnote in my post shortly to avoid misunderstanding.
        great discussion, I really enjoy it. when I’ve got time, I’d like to do a impact analysis to demonstrate if the test really works in the way I think it is and why.

        p.s. sorry I made a mistake in my second reply. the p for short is RSI itself and 1 – RSI for long, given the model is only active when p > 50%

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s