Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Martingale Betting Strategy

Hey all,

I'm interested in seeing some algorithms that employ the martingale betting strategy on high volatility stocks. I don't have much experience with this platform, so any thoughts are tidbits of code would be awesome. The strategy attempts to create a betting strategy that wins 100% of the time by doubling the bet each time. Under this strategy, if you can "win" twice in a row before running out of money (regardless of how many losses you've incurred already) then profit will always be realized.

More can be read here http://en.wikipedia.org/wiki/Martingale_(betting_system)

6 responses

I can't tell if you're kidding or not. Statistically speaking, over a large sample the Martingale actually wins 0% of the time with an expected portfolio value of 0.

"The strategy attempts to create a betting strategy that wins 100% of the time by doubling the bet each time."

"Under this strategy, if you can "win" twice in a row before running out of money (regardless of how many losses you've incurred already) then profit will always be realized."

Are either of these statements incorrect? Variations of the martingale strategy are ubiquitous throughout the financial world.

It is not ubiquitous.

Those statements are not incorrect, but that does not validate the strategy. Every strategy attempts to systematize a positive expected value. That does not mean it succeeds. And while the latter is true, running out of money with the Martingale is very easy. There's a reason it's brought up as a classic example of gambler's fallacy, and I would not be surprised if millions have lost their shirts using it. You may want to actually read that Wiki article.

The martingale strategy fails even with unbounded stopping time, as
long as there is a limit on earnings or on the bets (which are also
true in practice).[1] It is only with unbounded wealth, bets and time
that the martingale becomes a winning strategy.

You do not have unbounded wealth nor bets, only time.

@Ken Chen,

Yeah, bankruptcy is an absorbing state. agree with the 0% and 0

sigh @Ken Chen...

Anyways, the algorithm will work something like this.

  1. Buy 1 share of a stock.
  2. Wait for the stock to either rise 10% or fall 10%, a win or a loss, respectively.
  3. Sell all shares in the stock.
  4. Buy 2 shares of the stock, wait for a 10% rise or 10% fall.
  5. Keep doubling the bet. Once two wins have been recorded in a row, sell all shares and reset the bet to 1.

I hope you're not actually trying to trade that plan. Are you trying to prove why it would be such a terrible idea? If so, you can read about its terribleness on wikipedia.

If you're just looking to play with it, you can try this. Pretty crude, may have bugs, but it blows up as expected when you have too many losses in a row. A place to start at least.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.