Monday, August 13, 2012

Betting/trading strategies- Martingale

Introduction to betting strategies
Something I have been thinking about recently has to do with different trading/betting systems. I'll probably be doing a series of blog posts on this. Let me first define what I mean by a trading/betting strategy- this is a set of rules that dictate what you should do next based on your prior streak of wins/losses and your present P&L in the game (eg: gambling game, stock market...). The goal of this strategy may be to make money, but may also be to minimize variance (risk), avoid losing too much on money that has already been laid on the table (ie. successfully exiting losing positions), or to exploit a certain effect (eg: mean reversion, autocorrelation)...

For background, look at these 3 strategies:
Martingale is generally considered fatally flawed; daily re-balancing is a hot topic right now in finance (I'll explain more later); and Kelly's is actually a mathematically proven betting strategy.

In this post I will examine Martingale and a close cousin of it (trading version) and return to other strategies in later posts.

Mathematics behind the Martingale strategy
The Martingale basically says this: bet $1. if you lose, double down. if you lose again, double down again. So  you are "guaranteed" to win $1 at the end (unless you just keep losing ad infinitum). The major problem with this is that you only have a limited bankroll. eg: say after you've lost 10x in a row, you may be out of money and the casino/brokerage firm won't let you double down anymore (because you won't be able to pay if you lose again) At this point, you are close to bankrupt and you can't double down to recoup your losses anymore.

So the hidden downside is actually that you might go bankrupt before you win once. So the question is actually what is the probability that you would go bankrupt? Let's say in a 50/50 game you budget 1023x the initial bet (ie. you could lose 10 times and then be bankrupt). Then the chance of you going bankrupt per attempt to win $1 is around 0.1% (precisely 1/1024). Now let's look at the probability that you will go bankrupt as a function of how many times you attempt:



Note that while the curve (first graph) is bounded by 1, initially (say first 100 attempts- second graph), your chance of bankruptcy is almost linear to your # of attempts n. This is because Pr(bankruptcy) = 1-(1023/1024)^n  = 1 - (1 - 1/1024)^n ≃ 1 - (1 + n/1024)  = n/1024. This result is from first order Taylor series approximation (given small enough x = 1/1024 around the point a =1)

So for example, if you plan to attempt to win $500 (try 500 times), there is a 1-(1023/1024)^500 = 38.6% chance that you will "go bankrupt' before you reach 500 (ie. lose $1023- notice that you would still have the $499 or however much you collected before you go bankrupt). If you did go bankrupt before you reach 500, on average you would have gone bankrupt on attempt #230 (you get this by doing sum[Pr(n) * n] / sum[Pr(n)]. where Pr(n) = Pr(bankrupt on n-th turn) = (1023/1024)^(n-1) * (1/1024). I just summed this over excel- is there another way to do this?)

Soooo. let's see if this all makes sense.
EV = 38.65% * (-1023+230.2) + 61.35% * (+500) = 0

Betting strategies = transform your return distribution
So as you can see, by following the Martingale betting strategy and stopping at 500 wins, we can actually consider this whole strategy as one single bet of [win $500 with 61% probability or lose $793 with 39% probability], which is still 0 EV. ie. We have not gone anywhere from the original single bet of [win $1 with 1023/1024 probability or lose $1023 with 1/1024 probability] which is also 0 EV. Essentially the betting strategy has allowed us to change the distribution of returns while keeping your expected profit (EV) the same. This is an interesting topic that we will revisit later (probably when we talk about Kelly's criterion).

The interesting thing about this is that you can "see" your P&L progress over time. ie. instead of one single bet where you have 0 info about if you are going to win or not and that becomes 100% certain right after the dice roll, here, as you make successful attempts, you are slowly but surely moving towards the +$500 outcome (instead of the -$800 outcome. ie. the odds are slowly tilting in favor of you. One significant difference between gambling and trading is that trading is more continuous. ie. even though your trades are discrete, the market price changes rather continuously during trading hours. This is similar to what is happening here where you can see your P&L slowly accumulate before you finally exit the trade.

In trading, I would would look at this strategy as having positive theta (ie. as time passes, you start to make money). In this case, the reason why there exists positive theta is because you are taking extra risks on every iteration/bet/time period. Here, the risk you are taking is the 1/1024 chance that you lose 1023. When these risks are not realized, you make money. This is the case for say short gamma positions in trading. Short gamma positions basically mean that large price movements are bad for you. (vs long gamma positions ie. the people betting against you are betting on large price movements) So every second/minute/hour/day (remember trading is more continuous) that there is no large price movements materializing, these mini bets for large price movements are expiring worthless for the long gamma guy and you are making money because you have lived to fight another day/minute/second.

Further topics (to be discussed next)
So strats like these are highly dependent on budgeting. On a totally unrelated note, in poker, there's this concept called chunking- basically say you expect 3 more rounds of betting till showdown. Then you size up your opponent's (assuming he has less chips than you) stacks and figure out how to size the bets to get him all-in at the third bet. So for example, in a $15 pot right  now and your opponent having $100 stack left, you would say bet $15, $30, $60. The bets scale up every time because the pot has gotten larger. You for a small pot, it might turn out that you need 4 bets to be all-in- in which case you need some action (ie. a raise) to be able to go all-in. But the point of this discussion is that you need to do the same thing when you are budgeting for Martingale betting. ie. if I am going to bet 1,2,4,8,16 then give up, then I need to budget $31. And this $31 hopefully lasts me for the craziest price swings ever. ie. Let's say AAPL trades in $10 range 60% of time, $30 range 90% of time, and $50 range 99% of time. You should be betting say $1 for a $5 deviation from the median (whatever that means), $2 for a $10 deviation, $4 for a $15 deviation, $8 for a $25 deviation, and really really hold tight before you make your $16 bet at the end. ie. at what pt you double down is highly dependent on how rare of an outcome this pt is.

ok- back to martingale and its cousin trading strategy. The cousin trading strategy that I wanted to talk about was the following:

Buy the stock. Set take profit level at say +10%. If stock trades down, sit and wait. If it keeps trading down, sit and wait more. Since variance increases with time and is not bounded, this means that eventually stock will trade to +10% and you can exit at a profit. So this is similar to the Martingale in some respects. What I mean is this:


If you look at the chart above, the range of estimates for the stock increases the further you go into the futures. This is in part because the stock is expected to trade in a bigger and bigger range given longer and longer time periods. This means that it is easier for you to reach any pre-set level as time goes on, potentially even if the drift (general trend) of the stock is downwards (ie. the opposite direction to your bet).

This post is getting pretty long, so I'm actually going to talk about this strat more in the next post before going on to other strats. In the mean time, key thoughts about this strat:

It is also highly dependent on the return distribution. Need to compare how much increased variance over time contributes to probability of hitting target take profit level  (eg: 50% chance of touching x in y days, -> 50% chance of touching sqrt(2)x in 2y days) to "breakeven drag". ie. how much stock will have to trend down for you to have deteriorating chances of hitting target level (have negative theta).



No comments:

Post a Comment