Q:
"I am more than half way through your book and am stuck at a concept that I can't seem to find an answer in any other forum.A:
I have read Ralph Vince's "Portfolio Management Formulas," which uses Kelly's formula to calculate an optimal "fraction" of the bankroll to bet on each trial. So a trader can calculate a fraction of his total trading account value to risk on each trade. What I am referring to is the so-called "fixed-fractional" trading. There exists an optimal fraction that will maximize the geometric growth rate of the trading equity, in theory anyway.
However, in the money management chapter of your book, you use Kelly's formula to derive an optimal "leverage." This seems to be in conflict with what I learned from Ralph Vince, since leverage is usually great than unity and fraction is usually less than unity. I can't seem to make a connection between these two concepts. I have also seen the same optimal leverage formula in Lars Kestner's Quantitative Trading Strategies and asked the same question on some forums, but no one was able to give me a clear satisfactory answer. It would be greatly helpful if you can help me sort out the confusion."
I don't have Ralph Vince's book with me, but if I recall correctly, his formulation is based on discrete bets (win or lose, no intermediate outcome), much like horse-betting or in a casino game. My approach, or rather, Professor Ed Thorp's approach, is based on continuous finance, assuming that every second, your P&L could fluctuatate in a Gaussian ("log-normal") fashion.
For discrete bets where you could have lost all of your equity in one bet, surely one should only bet a fraction of your total equity. For continuous finance, there is very little chance one could have lost all of the equity in one time period, due to the assumed log-normal distribution of prices. Hence one should bet more than your equity, i.e. use leverage.
Q:
In example 6.2 in your book, the portfolio consists of only long SPY, which has little chance of going to zero. So I can see how it is reasonable that you use the continuous finance approach and apply the optimal leverage to scale up the return.A:
But let's assume that the portfolio consists of a single strategy that buys options. Suppose this strategy will lose most of the time due to time decay but will make profit once in a while due to black-swan events. I don't think it's a good idea to bet the entire portfolio equity on each trade for this strategy. Can you still apply the continuous finance approach in this case, since in reality trading is like making discreet bets? Should we expect the mean and variance of this strategy automatically result in an Optimal Leverage that is less than one? So that we actually need to risk a fraction of the account equity per trade?
The formula I depicted in the book is valid only if the P&L distributions are Gaussian. If one expects a fat-tailed distribution due to black-swan events, a different mathematical model needs to be used, though it can still be within the continuous finance framework. However, for simplicity's sake, if the distribution looks multinomial (e.g. high probability of "Win a lot" v "Lose a lot"), then you may model it with fractional betting just like a casino game.
54 comments:
Hello Ernie,
Henry from Vancouver. Just wanted to stop by and say i bought your book recently and absolutely loved it. I am also a Kelly formula nut. A year ago I've asked almost the exact same questions as your reader did. And I came to the same conclusions as you did.
On another note, I am seeing huge distortions in several pairs. XLE/XLF has recently reached 5 standard deviation and probably hit an important high. What are your thoughts on this one?
Hi Henry,
Thanks for confirming my thoughts on Kelly formula!
Regarding XLE/XLF, they are in quite different sectors, so I don't have any reason to believe they cointegrate. So why should we expect any mean-reversion?
Ernie
Commodity pairs are more likely to cointegrate, but they don't necessarily. It is best to run the cointegration test as recommended in my book (e.g. Example 7.2)
Ernie
Hi Ernie
Like Steven L my previous experience with Kelly was via the fractional method seen in horse racing or casinos books.
It wasn't until I purchased your book and saw example 6.3 that I realized that in a Gaussian distribution, Kelly can actually give an allocation as a “short” investment.
I am still playing around with Matlab and example 6.3, but does that mean that with Kelly I could take say 2000 days of data for three stocks, calculate the F's on say the first 500 days (to get me a starting allocation), then re-do it each day i.e. using 501 days, then 502 days rebalancing each day. Or maybe just over a rolling 500 day period.
Given Kelly can provide a “short” allocation (by virtue of the covariance and returns between the assets), does that mean that after 2,000 days I'll be in front regardless of the asset returns because Kelly will obviously keep re-weighting favorably to the "best" asset and if its going down then Kelly’s F will be shorting it more and more? or equally buying one asset more and more?
Is this not like Cover's Universal Portfolio where we are guaranteed to beat the best stock in the portfolio by continually rebalancing?
So should I just invest in a bunch of traditionally uncorrelated assets and keep rebalancing with Kelly each day and I’ll be rich !! I very much suspect the answer is no (!) so can you please comment on some of the challenges with this approach. Assuming a Gaussian distribution of returns is probably one of them :-)
Thanks
PS. I very much enjoyed your book.
Thanks for posting your dialog, Ernie. Money management is so important, and discussion of it is too rare.
Since the dialog mentioned Ralph Vince's Optimal f, I wanted to add a footnote to the discussion. I thought Optimal f was pretty cool when I read Vince's book. Fortunately, I did my homework and discovered a serious problem: The value of 'f' is not stationary -- that is, you get different 'optimal' values at different times. This is a fatal problem since a wonderful f today could be a miserable f tomorrow, leading to out-sized losses.
Until Vince can figure out how to calculate a stable f, I won't be using his approach.
Paul
PS to Henry - I did a quick check, and the XLE/XLF pair is not mean-reverting; in fact, it's not even close. I wouldn't trade it!
Hi anonymous,
Yes, you should use a rolling 500 days to recalculate f every day (or week, month, etc.)
Indeed Kelly's formula is very much related to Cover's universal portfolio. However, Kelly did not prove that reallocation based on past history is predictive of future returns. It merely renders the probability of ruin very small. On the other hand, Cover did prove that Universal Portfolio will lead to positive returns. (Except that transaction costs may overwhelm those.)
Ernie
Hi Paul,
What if you revise Vince's optimal f using, say, rolling 500 days lookback? Would that make the optimal f useful?
Ernie
Ernie:
That's a good question. I did not try evaluating optimal f that way, so I can't speak to the possible effectiveness of an adaptive version. I assume the answer depends on how quickly and how smoothly the optimal f transitions between its regimes -- if it has "regimes" at all!
Paul
In your book you don't really prove Kelly's formula. And it seems Thorp in his paper ommit important steps in the derivation. Filling the gaps requires some legwork, and is not really straighforward. There is a way to derive which is different from Thorp and it seems to be much simpler (unless of course I am missing something in Thorp)
Anonymous, i'm interested in the alternative approach to derive it. Please send me an email at henry.bee@gmail.com
Henry
Anonymous,
Do you disagree with my derivation in the Appendix of chapter 6? Would you like to share your alternative derivation here?
Best,
Ernie
He's referring to the derivation of the growth function, which involves expansion of a product series.
Henry
Hello Ernie
Great book!
In accordance with the principle "the only stupid question is the one you're too afraid to ask", I have a question about Example 6.3(Calculating the Optimal Allocation Using Kelly Formula)...
... What is the answer?
... What is the optimal allocation between OIH, RKH and RTH in the example?
As far as I can see the answer is not given in the example ...
Thanks
Ben
Hi Ernie
I am reading your book at the moment and really enjoy it!
I am wondering if you can use Kelly for intraday/high frequency trading? The two problems I see is that you can question whether the intraday returns are Gaussian?
Secondly, the Kelly formula optimizes the long-term growth rate, where investors and PM's goal often is to max. the Sharpe ratio. Do you see any conflict in this in regards to using Kelly?
Thanks
Hi MJ,
Certainly Kelly formula can be applied to any trading horizon, including high frequency.
Maximization of the Sharpe ratio leads to the maximization of long-term growth rate if you adopt the optimal leverage. (See the last paragraph of pg. 98.) So they are consistent goals.
Ernie
Hi Ben,
In Example 6.3, the optimal allocation is given as F in the Matlab code on top of page 102.
F=1.29, 1.17, -1.5
Ernie
Thanks Erie for the swift response.
What I don't understand is how these numbers represent an "allocation".
I can see how they indicate the optimal leverage, but if I have equity of, say, $100,000 do these numbers also tell me how much I should put in each? That is what I understand by "allocation" ...
Ben,
Assuming your equity is $100,000, with F=1.29, 1.17, -1.5, you should long $129,000 of OIH, long $117,000 of RKH, and short $150,000 of RTH.
Ernie
I recently bought your book and have been reading it. I am trying out the examples, but since I don't have matlab, I am unable to execute them. Is there any excel equivalents for the examples you are talking about for the matlab examples in your book.
vina,
You may be able to find some Excel substitutes (for e.g. a reader said on this blog that there is an Excel adf test somewhere). However, many of the strategies are difficult to implement in Excel. That's why many quants use Matlab for backtesting instead.
Ernie
Hi Ernie,
Thanks for your excellent book and the excellent blog. I just wanted to consult with your expertise: can the Kelly formula, the Optimal-f, the leverage space model, and the universal portfolio theory, etc. be applied to long-short futures portfolio?
Any pointers are greatly appreciated! Thanks a lot!
Hi Anon,
Yes, all these concepts you referred to are completely general and can be applied to any financial instruments.
The only caveat to watch out for is when the returns are too far from a gaussian distribution, then the exact optimal f may not be accurate.
Ernie
Hi Ernie,
Thanks for your reply. Sorry I am not Anon. In a futures long/short portfolio, on a rebalance day, what would you reinvest based upon, the equity capital, or the notional amount? Do we require the weights sum to 1, or nothing? Futures don't need any initial cash outlay, except there will be a margin requirement. How's this handled in either Mean-Variance or models? Thanks a lot!
Kelly formula concerns only 2 quantities: your account equity, and your gross market value. The 2 need to be maintained at a fixed ratio. Gross market value of long-short futures portfolio can be read off your account statement. I am afraid it has nothing to do with cash outlay, weights summing to 1, or mean-variance model.
Best,
Ernie
Hi Ernie,
Sorry I've lost you. Could you please give an example of how a short position of futures (number of contracts) is calculated using Kelly's formula?
Thank you very much!
Hi Ernie,
It's now clear on this part. Thanks so much for your explanation. However, when I tried to apply the Kelly formula in your book(which takes into account the correlation and hence using the covariance matrix), the result was very poor. I ended up in ruin. The literature talks a lot about the garbage-in-garbage-out issue. How would you address the issue that we don't know the expected return and covariance and the historical estimates are often poor and if we use those in Kelly's formula we end up in ruin very quickly... ?
Thanks a lot again for your excellent book and excellent blog...
Hi Anon,
You are right about data quality issues. That's why traders use half-Kelly instead of Kelly to allow for errors in average returns/volatility estimates.
You are also right that estimates of correlations can be even worse than that of mean and variance, especially if you use real trading records which may be short or spotty. One drastic shortcut is just to assume correlation is zero, except in the case where the 2 strategies are very similar, in which case you can just assume a 100% correlation. The other is to use backtest returns instead of live returns to compute correlations. You can have a large dataset for this backtest estimation.
Ernie
Hi
Can the Kelly formula be used for leveraged trades?
For example, an win ratio of 0.6 and RR 1:1, gives approx 20% equity. We can use half kelly to get a value of 10%. However, when we put this into a stock it is very unlikely to hit zero. In a leveraged bet with a stop loss of 10% we could lose that entire 10% in a matter of seconds or minutes.
Also, 1 extra thing to note/ask.
Kelly says that the 0.5, 1 is a zero sum game. However, when you put these into an actual calculation and an ideal world of 1 win, 1 loss, 1 win, etc., you actually end up losing overall because the bet size is recalibrated on each bet.
1000.00 0.1 loss 900.00
900.00 0.1 win 990.00
990.00 0.1 loss 891.00
891.00 0.1 win 980.10
980.10 0.1 loss 882.09
882.09 0.1 win 970.30
970.30 0.1 loss 873.27
873.27 0.1 win 960.60
960.60 0.1 loss 864.54
864.54 0.1 win 950.99
J,
I believe you are referring to Ralph Vince's formulation of Kelly's formula in your last 2 posts. Vince's formulation is based on a bet with discrete outcomes, hence the notion of win/loss ratios etc. I followed Ed Thorp's continuous finance formulation in computing Kelly formula, which only requires mean and variance of returns. Also, Thorp's formulation is all about determining the optimal leverage, so the answer to your first question is: "obviously yes".
And if you follow Thorp's formula, the scenario in your second post will never happen.
Ernie
J,
By the way, you can read detailed description of Thorp's formulation either in my book "Quantitative Trading", or on his website http://edwardothorp.com/.
Ernie
Interesting to read about cointegration. My thesis was about it so a nice trip down memory lane.
Ralph Vince has written a new paper on the distinction between optimal f and Kelly's criterion, which addresses some of the issues posted here. You can download it here: http://parametricplanet.com/rvince/optfnkelly.pdf
Mak
Hello, Ernie
I'm currently a junior in university studying math. Algothimic Trading is certainly not in my future career, but it is something I would like to learn as a side project. I've flipped through the vast amounts of information on the web, and I was curious, aside from your book, what are some other useful books to start learning such material?
Hi Mak,
You can check out the Recommended Books section on the right sidebar of my blog.
Ernie
I'm also interested in a more detailed derivation of Kelly's formula for the multiple security continuous case. Thorpe's paper is very good, though he skips a lot of steps and I'm not able to easily fill in the blanks at my current level of math skill. Specifically, the parts about product series expansion and later the covariance matrix.
Tangentially, does anyone understand Ralph Vince's optimal f? [http://www.epiheirimatikotita.gr/elibrary/finance/The%20Mathematics%20of%20Money%20Management%20-%20Risk%20Analysis%20Techniques%20For%20Traders%20%28Ralph%20Vince,1992%29.pdf p.31, "FINDING THE OPTIMAL f BY THE GEOMETRIC MEAN"]
How can he be finding the optimal f without assuming any probability distribution first? The part "-trade/biggest loss" is never proven or even explained... seems like nonsense?
Basically (from what i understand), he's using the multinomial probability distribution implied by a series of trades from a backtest.
That's where he gets the "biggest loss" number.
Then, it makes sense that the optimal f is between 0 and 1.
What is not so clear for me is how you accomodate this "Optimal f" with leverage?
Let's say your biggest loss on a given trade was 30% and optimal f is 0.4, do you leverage yourself to
(1.0/30%) x 0.4) = 133% of your AUM ??
My 2 cents.
Hi i was wondering why did you decide upon a 500 day moving window for continually recalculating your leverage ratio? should this number be optimised? What happens if your kelly optimal leverage changes dramatically according to the window chosen...what does that suggest to you? Your thoughts would be appreciated.
Hi,
The 500 day moving window is only valid if you believe, based on fundamental considerations, that there is no regime change affecting the profitability of your strategy.
If there is such a fundamental shift, we need to adapt the window accordingly.
In practice, we can usually only discern a regime shift in retrospect, but that is good enough for us in determining what window to use.
Ernie
Thanks for your answer Ernie,
On your point about the regime shifts, if running a strategy...that for lets say for the sake of simplicity buys SPY at 1pm and sells it at 2pm (on the reason say that you think ETFs might carry out hedges at this time), and you found that this was profitable over time, calculated an optimal leverage ratio using a 500 day window say its 3x...but then your strategy starts too loose money quickly due to a "regime shift". At 3x leverage...i can imagine that you might loose a lot of your trading capital quite quickly...
when do you make the call that that 500 days might be too long and that you might want to shorten it or lengthen it? and even if you did length or shorten the window of optimal leverage calculation...does it not merely change the leverage ratio? and if shortened enough could it not then start suggesting negative leverage, i.e. due to money management rules, would be reversing your once profitable strategies. i.e. instead of buying at 1pm you would be selling?
Hi Anon,
Merely losing money does not necessarily signal a regime shift. As I said, it is hard to detect one in real-time. So my practice is to not change the lookback just because a strategy is losing money, unless I have fundamental reasons to believe there is a regime shift.
However, the beauty of Kelly formula is that once you start losing money, the market value of your portfolio will be reduced even if you keep the same leverage.
Ernie
Hi Ernie,
Thanks for your quick response.
Agreed that loosing money doesn't alway suggest a regime shift.
So i guess my question is under what circumstances would you change the look-back period..and if you decide not to change it (as you suggested)..then why focus on 500 days? or any other arbitrary number of days?
Which also goes to my original issues of what if using a 500 day window suggests leverage of 3x but using a 200 day window suggests using 1.5x...and on a 100 day window it suggests -2x....from a money management perspective... this is perhaps a bit worrying...as you would be staking very different amounts for your next bet/trade...
Hi Anon,
If 500 days give different leverage than 300 days or 100 days, then we should use 500 days, unless you think the regime has shifted in the last 300 or 100 days.
One should use the longest lookback possible consistent with the current regime.
Of course, this sounds clear-cut, but how do you determine a "regime"? That is the more subjective part of the business, and relies on your fundamental knowledge or judgement. Obviously, a strategy that depends on shorting stocks will experience regime shifts if the short-sale rule changes.
Ernie
Hi Ernie,
Do you think that perhaps that this subjective element of working out if there is a "regime shift" then makes it reasonably similar to picking stocks...i.e. if being long APPL was your strategy for example, (at what ever leverage ratio you want), and then you saw a series of negative returns...or you believe there is a "regime shift" due to say for example a change in CFO or perhaps more subtely a change in advertising approach ... then this subjective element is not too dissimilar to looking for past winners and hoping that they stay as winners in the future and hoping that there is no "regime shift" in the future but just doing it for strategies rather than single stock companies?
Hi Anon,
Certainly, changing a CEO for a company can be considered a regime shift for a company. But for a strategy, some market-wide discontinuity need to occur.
Ernie
Hi Ernie,
Some great info and discussion here on Kelly.
I've recently been backtesting a strategy without using any leverage or compounding growth. In my backtests I limit my open positions to 1 contract of the same amount each time (with a fixed estimate of comission and slippage per trade). I'm now keen to try and model a more realistic backtest of how my strategy would perform when leverage and position sizing (using the Kelly formula) and compound growth are taken into account.
Question 1: Is it ok to take the Sharpe ratio from my existing (un-levered, non-compounding) backtest and use that as the starting point to calculate the leverage I should use for my more realistic backtest?
Question 2: After having run a more realistic backtest taking leverage into account, I will have a new Sharpe ratio.
If I were then to start paper trading, should I use this new Sharpe ratio as my starting point?
i.e. Should I take my starting Sharpe ratio from a levered (with compound growth) or un-levered (and non-compounded growth) back test?
Many thanks,
Ed
Hi Ed,
Sharpe ratio should always be calculated using non-levered returns. But in any case, it should be the same even if you apply leverage, as it affects both the numerator and denominator by the same factor.
Ernie
Thanks Ernie. Yes, I hadn't thought about the Sharpe ratios being the same.
Regarding the use of compounding growth in the backtest from which I will calculate the Sharpe; would you recommend this approach if it is more realistic to the way I would trade for real?
Or would you recommend running the backtest with a set fixed amount per trade?
(The latter is the way I have been running backtests up until now, in order to compare like for like when testing various strategies, but I feel using compounding growth may be a better approach.)
Many thanks,
Ed
EdL,
You can use compounded returns for your backtest. The compounded returns should of course be calculated using levered per period returns.
Ernie
I know the kelly criterion gets a bad rap a lot of times, but the truth is that it's the best money management system out there. When you put it up against any other system it wins hands down for the rate of return it produces relative to bankroll size and volatility. The reason people don't really understand it is because it is only half of the equation. Most people can't predict winners consistently or evaluate their edge accurately. Without those two things the kelly calculator won't help you much.
Hi Ernie,
I have back tested a strategy where in there are number of continuous buy signals and sell signals. For eg, I have a buy, then another buy trigerrs and subsequently another 3 buys trigger..I have limited 5 number of consecutive buys and similarly max number of sells at 5. At times there maybe only 1 buy followed by 1 sell and so forth so on. My system is based in retracement of prices.
Now in this kind of scenario, how do I determine the optimal leverage and also the optimal bet size for a given size of portfolio of say 1 million usd using Kelly ?
Hi Unknown,
First, Kelly formula is based on unlevered returns, so you first have to calculate that properly: it is the P&L divided by the gross market value. In your case, the gross market value may double or triple for some period due to the 5 levels of entries.
Second, after the optimal leverage is calculated based on your unlevered returns, it refers to the average leverage. So you have to determine the average number of levels you use, and use that and the optimal leverage to compute the bet size for one level.
Ernie
Thanks For the reply Ernie...
I would request further view from your side on this problem at hand.
Let's say my optimal leverage comes at 2x
Now let's say in the lookback period, my average levels comes at 3 .... how would now i decide what should be the bet size in level 1, level 2, level 3 , level 4 and level 5.
Some light on this would be really appreciated.
Regards
Puneet
Hi Unknown,
If your average number of levels is 2, and the optimal leverage is 2 also, then each level should get a leverage of 1, even though sometimes you might get up to 5 levels.
Ernie
Post a Comment