
October 8, 2018
Martingale Strategy
The martingale strategy requires a gambler to double his bet after every loss. So let's say you start with $10 and you choose to bet $1. You lose your bet and now have $9. According to the martingale strategy you now have to double your bet to $2. Assume you lose your bet again. You now have $7. According to the martingale strategy, you must double your bet again. You bet $4 this time and win your bet. You now have $11. The whole point of doubling your bet is so you can recoup all of your previous losses and make the amount you would have made on your original bet of $1. After a winning bet, you can bet whatever you want on your next round of bets. You could choose to start off with betting $2 and repeat the process of doubling your bet every time you lose. https://en.wikipedia.org/wiki/Martingale_(betting_system)
To summarize the rules
-
Decide on an amount you want to bet
-
If you win the bet, then you may choose a new amount to bet
-
If you lose the bet, then you must double your previous bet
-
Every time you lose you must continue to double your previous bet
-
When you finally win you may choose a new amount to bet
If you missed the meeting and want to replicate this strategy on your own, you will need something to act as your currency (coins, marbles, torn pieces of paper, etc.) and a die. At the meeting, we declared that any time the die landed on 4 or higher, it was a winning bet and a losing bet if it landed on a 1 or 2 which put the probability of winning a bet at .5. You can experiment with different probabilities by altering what decides a winning bet and what decides a losing bet.
In the long run, the martingale system (depending on your chance of winning a bet) eventually causes a person to lose all of their money. The whole point of going through this betting strategy is to show the importance of managing your risk when developing a trading system. Although you most likely won't use the martingale system to determine how much money to place on a trade, it's important to understand that even if the probability of suffering a catastrophic loss is small, it could still happen and blow up your trading account.
A Few Common Errors in Backtesting
Survivorship Bias
​
When you're running a backtest for a strategy that trades individual stocks, depending on the data you're using, there's the possibility of encountering survivorship bias. Survivorship bias occurs when the data you are using to perform backtests does not include delisted stocks. Using data with survivorship bias can inflate your backtest results because it only tests your strategy on stocks that have survived over the course of the testing period rather than the stocks your strategy would have picked at that moment in time. Quantopian has survivorship bias-free data.
An excellent example of survivorship bias is testing a strategy on the current constituents of the S&P 500. Periodically companies are removed from the S&P 500 for many reasons such as their market cap falls too low. If the trading universe for a backtest consists of the current constituents of the S&P 500, then this backtest does not consider stocks that were removed from the S&P 500 and the results could be inflated
​
For our non-survivorship bias example, we tested a strategy that:
-
buys the top 10 stocks by market cap
-
holds the stocks for a year
-
sells all of the stocks that are no longer in the top 10 by market cap
-
buys the new stocks that are in the top 10 by market cap
-
repeat

For our survivorship bias example, we chose a strategy that:
-
buys the top 10 stocks by market cap as of 2018
-
holds the stocks for the entire testing period

Look Ahead Bias
Look ahead bias occurs when your strategy makes decisions based off of events that occur in the future. Obviously, this is a big error because nobody knows what is going to occur in the future.
For our non-look-ahead bias example, we made a strategy that:
-
100% long if SPY closed above its 3-month moving average
-
100% cash if SPY closed below its 3-month moving average

For our look-ahead bias example, we made a strategy that:
-
100% long at the beginning of the month if SPY closes above its 3-month moving average at the end of the month
-
100% cash at the beginning of the month if SPY closes below its 3-month moving average at the end of the month

Insufficient Data
Insufficient data occurs when you do not have enough data for the strategy you are testing. For example, if you tested a buy and hold strategy on SPY from 2010-2018, the results wouldn't be as reliable as the results from a test of the same strategy on a much longer time frame. Also, a strategy that does not make enough trades during a backtest may not be statistically valid. To learn more about this, you can search for "statistically valid backtest" or "margin of error and backtesting".
​
For our example, we made a buy and hold strategy for bitcoin. The first test was from 2016 to 2017.​

The second test was from 2016-Present

A general rule of thumb: if it looks too good to be true, it probably is