Saturday, February 16, 2019

Will the real Kelly please stand up?

Quick post this one; most of you probably already know about the Kelly criterion: https://en.wikipedia.org/wiki/Kelly_criterion

...well, make sure you check this out: https://blogs.cfainstitute.org/investor/2018/06/14/the-kelly-criterion-you-dont-know-the-half-of-it/  ...because you might be using the "wrong Kelly"!

Here's how the correct one looks like in Clojure with primitive type hints so the compiler will generate proper code suited for your CPU; really, really simple:

(defn kelly-criterion% ^double [^double win-chance ^double avg-winner ^double avg-loser]
  (- (/ win-chance avg-loser)
     (/ (- 1.0 win-chance) avg-winner)))



I had to "choke" this or it would in some cases generate very high leverage trades on my backtest. I tried basing the kelly% on a 14 day window so it will be more reactive based on the current market state -- and this was the result for a very simple momentum trader (edit: i'll try posting the original later; so you can see a before vs. after):

XBTUSD (futures). When kelly% goes negative we do not trade -- and we are more aggressive (leverage) when confidence is higher. Depending on your stomach, the amount of leverage could probably be throttled a bit further than what I've done here.

..for me this represents a big improvement; even for a trivial strategy.

update: here's the same strat without any kelly% =>

No kelly%; just fixed order size. This trades even when the strategy performs poorly and one can perhaps argue that it not aggressive enough when the strategy is doing well.
 

No comments:

Post a Comment