General Topics
Technical Topics
Brokerage Firms
Community Lounge
Site Support

Discussion in 'Risk Management' started by kut2k2, Aug 22, 2007.

Not open for further replies.
1. ### kut2k2

Here's a primer for those traders who are confused abut Kelly sizing.

You have a trading strategy that you want to evaluate. Naturally you'd want to perform a backtest.

For the first test trade, you put forth an amount of money t1 into your favorite trade instrument, and at the end of the first test trade, your trading account changes by an amount t1*R1, which may be positive, negative, or zero. And t1*R1 includes slippage and commissions.

For the second test trade, you put forth an amount of money t2 (which may or may not be equal to t1) and your equity changes by an amount t2*R2 (including slippage and commissions).

You continue this for some statistically significant number of test trades (n), and your final equity differs from your initial equity by an amount t1*R1 + t2*R2 + ... + tn*Rn = sum[ti*Ri]_n.

What the Kelly formula does is answer the following question:

Gain[f] = (1 + f*R1)*(1 + f*R2)*...*(1 + f*Rn)

This function is maximized at f = k and mathematically (don't ask, it involves logarithms and calculus :eek: ), this reduces to

0 = R1/(1 + k*R1) + R2/(1 + k*R2) + ... + Rn/(1 + k*Rn)

This is unsolvable exactly for the general case, but it can be solved numerically for a specific case with a canned routine like Excel's Solver.

Fortunately, the last equation can be approximated by the following:

0 ~ R1*(1 - k*R1) + R2*(1 - k*R2) + ... + Rn*(1 - k*Rn)

0 ~ sum[Ri]_n - k*sum[RiÂ²]_n

k ~ sum[Ri]_n / sum[RiÂ²]_n

This is sometimes expressed by blackjack card counters as "expected return over expected squared return". Six little easy-to-remember words.

The best things about this approximation are (1) it can be instantly updated with each new completed trade (or each new count after a blackjack hand) and (2) it will always underestimate the actual optimal betting/trading fraction, thus reducing the dreaded "Kelly risk" eek: ).

Example 1

You're sitting in a cocktail lounge with a rich compulsive gambler and he talks you into playing the following game. Betting only the risk capital in your pockets, he will flip a coin (you've examined it, it's fair) and if it comes up tails, you lose your bet. But if it comes up heads, he will pay you double your bet.

How much of your betting account should you bet?

Given this simple two-outcome situation, the usual Kelly formula you see posted can evaluate this exactly: 25% of your betting account will on average grow your money the fastest.

Using the approximation gives k ~ (2 + (-1))/(2Â² + (-1)Â²) = 1/5 = 20%.

This is 80% of the optimal fraction. Not too shabby for a quick-and-dirty approximation.

Example 2

Your new rich friend/compulsive gambler decides to up the ante. He brings out an opaque jar containing ten balls. Before the game begins, you examine the balls and they are identical in every way except color: there are seven yellow balls, one red ball and two green balls. Then he puts the balls in the jar and reaches into the jar without looking and swirls them around and pulls one out.

If he pulls out a yellow ball, you lose your bet. If he pulls out the red ball, you lose five times your bet. If he pulls out a green ball, you win ten times your bet.

How much of your betting account should you bet?

Using the approximation gives

k ~ (7(-1) + (-5) + 2(+10))/(7(+1) + 25 + 2(+100)) = 8/232 = 3.45%

This is 76.5% of the optimal fraction (4.51%), which you can get from Excel's Solver.

Using the typical posted Kelly formula, you'd reduce this to a 2-outcome sitch (2 green balls worth +10 each and 8 orange balls worth -1.5 each) and end up overbetting:

Kelly_typical-posted = p - (1-p)/(W/L) = 0.2 - 0.8/(10/1.5) = 8% :eek:

HTH
kut2k2

espresso likes this.
2. ### ronblack

This does NOT account for the fact that you can have a streak of losers and given the fractions used, you will never be able to recover your losses. Isn't that exactly what happens to small account retail traders? If you lose 50% of your account you need a gain of 100% to recover your losses for example.

I think Kelly% does not account for consecutive losers and the fact that it may be impossible to recover losses after that or even trade at all.

Ron

3. ### kut2k2

The formula for risk from Kelly betting comes from one of the blackjack sites by Don Schlesinger:

Prob[A reaches yA before xA] = [x - 1]/[(x/y) - 1]

where A is the starting bankroll ;
x is any positive multiple ;
y is any other positive multiple.

So the probability that you double your betting account before seeing it cut in half when Kelly betting is [Â½ - 1]/[Â½/2 - 1] = 2/3 = 67%.

The probability that you can increase your betting account 100-fold before seeing it cut in half when Kelly betting is [Â½ - 1]/[Â½/100 - 1] = 50.25%, i.e., more than half.

More to the issue of ruin, the probability of doubling, tripling, billion-upling, etc. your account before seeing it reduced to zero is [0 - 1]/[0/y - 1] = 1= 100%.

IOW, there is zero risk of ruin with Kelly.

4. ### maxpi

There is zero risk of ruin as long as you can characterize your system properly. If you use hard stops and goals with a known reward/risk at the entry of every trade you need to watch the win%. If you exit on TA then you have to track the win% and the reward/risk.

5. ### ronblack

That says nothing really. The probability when using Kelly to lose 1/n of your equity is 1/n. Thus, if you have 1,000,000 the probability to lose 500,000 is 50%. This is awfully high probability especially for fund managers who usually close the fund if a 50% drawdown occurs.

I mean 1/n is not a good probability function for drawdown. Yes, you cannot go to zero but this is due to the asymptotic nature of the function. It is very hard to continue trading is you started with 1,000,000 and have only 20,000 left in the account like it happened to many gamblers who used Kelly criterion to bet on tech stocks after the Nasdaq bubble market.

Practically, risk of ruin is to me the inability to continue trading, not reaching 0 equity. In that respect, Kelly should be avoided.

Ron

6. ### u21c3f6

Using your figures I calculate Kelly as follows:

Wagers: 7+5+2=14
Avg wager=14/10= 1.4
Return: 11 per winning wager
.2 win %
.8 lose %
odds= 11/1.4= 7.857

k= (7.857(.2)-.8)/7.857= .098

The problem with the above is that it is based on an average wager of 1.4 but there is the possibility of losing 5. Therefore I adjust the wager by: 5/1.4= 3.57

k=.098/3.57= .027

Joe.

7. ### kut2k2

It really pays to know where these dire predictions you're quoting come from. Btw I read the same thing in wikipedia:

The probability of reducing your account to 1/n with Kelly betting is 1/n.

Here's the whole story: that figure comes from the probability formula I posted above and it is the probability of reaching 1/n before reaching in-f'ing-finity!! Think about it. Puts things in a whole different perspective.

For us sane people who don't plan on acquiring all the money in the universe and then some, the probability of seeing your account cut in half before reaching your humongous-but-still-finite goal is less than 50%.

I guess I posted that 100-fold example for nothing, huh?

For those who care, the risk formula for Â½ Kelly betting is

Prob[A reaches yA before xA] = [xÂ³ - 1]/[(x/y)Â³ - 1]

You can always reduce your risk by betting less than full Kelly, but if you don't know your Kelly point, how will you know when you're overbetting?

8. ### kut2k2

I have no idea where this version of Kelly comes from but to each his own.

9. ### maxpi

kut2, thanks for the nicely informative thread.

10. ### u21c3f6

"I have no idea where this version of Kelly comes from but to each his own. "

It's the same formula just repackaged. It is basically your edge divided by your odds (this form is mostly used for "gambling" propositions IMO).

k = (bp - q)/b

where

f is the fraction of the current bankroll to wager;
b is the odds received on the wager;
p is the probability of winning;
q is the probability of losing, which is 1 &#8722; p.

The adjustment I made based on wager size is my own "creation".

Joe.

#10     Aug 23, 2007