Martingale Trading Strategy (Backtest And Example)
Last Updated on January 20, 2023
There are different strategies for trading the market, such as trend following, price action, scalping, momentum, Martingale, mean-reversion, and so on. All are risky, but the Martingale trading strategy is known for its huge risks. What is this strategy and how does it work?
In financial trading, the Martingale trading strategy refers to the idea of adding a larger trade size to a losing trade with the hope that the market eventually reverses and it ends up with a net profit equal to the size of the initial bet. The idea was originally made for gambling, and it is based on the statistical outcomes of an event with a 50% probability of it occurring, such as winning a trade.
In this post, we take a look at the Martingale strategy. The strategy is not among the easiest to backtest with strict trading rules, but we make an example of a backtest at the end of the article.
What is the Martingale trading strategy?
In financial trading, the Martingale trading strategy refers to the idea of adding a larger trade size to a losing trade with the hope that the market eventually reverses and it ends up with a net profit equal to the size of the initial bet. That is, if a $1 trade is losing, you make a fresh $2 trade in that direction and continue doubling each fresh position size until you win and recover the losses plus a profit worth the initial $1.
The idea was originally made for gambling, it’s famous among those who play roulette, and it is based on the statistical outcomes of an event with a 50% probability of it occurring, such as a coin toss. For this type of situation with an equal probability, the Martingale strategy states that if you double the size given a loss, you regain whatever’s been lost plus a profit.
This technique is in contrast with the anti-Martingale system, which involves halving a bet each time there is a trade loss and doubling it each time there is a gain. Unlike the anti-Martingale, which seeks to reduce risk, the Martingale strategy is a risk-seeking method of investing that betrays an aversion to accepting losses.
The Martingale strategy is based on the theory of mean reversion in trading, which opines that the price retraces towards its mean after some time. Since the market is likely to reverse at some point, it believes the trader should increase the amount invested as the price falls —in anticipation of a future increase. However, without an infinite supply of money to keep investing, the strategy won’t work. Moreover, the amount risked by continuing to invest is far higher than the potential gain.
The Martingale strategy is commonly used for betting in a casino to break even after a loss. After experiencing a loss, gamblers would double the size of the next bet and continue down that path until they eventually even out with a win or have no money to bet. If the gambler has an unlimited supply of money to bet with or at least enough money to make it to the winning payoff, the strategy works. If he runs out of cash, he loses everything — an addict might even bet (and lose) his house.
How the Martingale strategy works
Let’s look at a basic example to explain how the Martingale strategy works. Here, we use coin tossing and bet on either heads or tails. There is an equal probability that the coin will land on heads or tails, and each flip is independent — the preceding flip does not impact the outcome of the next flip.
The best strategies can be found in our….
Backtested trading strategies
The Martingale strategy states that as long as you stick with the same call, say heads, you would eventually get a win (see the coin land on heads) if you have an infinite amount of money to keep betting.
Now, let’s say you bet with a fixed sum of $100, and the bet was a loser (tails instead of heads). You would increase your bet size to $200. If it comes out tails again, which is another loss, you increase your trade to $400. You continue this process until you end up with a winner.
Here’s what the outcomes would look like:
- If you win the first bet, you win $100
- If you lose the first and win the second bet, you end with a net $100 profit ($200 – $100)
- If you lose the first two bets ($100 + $200 = $300) and win the third bet, you end up with a net profit of $100 ($400 – $300).
- If you lose the first three bets ($100 + $200 + $400 = $700) and win the fourth bet, you end up with a $100 net profit ($800 – $700).
You can see that, at any stage, the size of the winning bet will exceed the combined losses of all the previous trades, and the difference is the size of the initial bet.
Is the Martingale system the same as the double-down strategy?
The Martingale strategy may look very similar to the double-down strategy, and in fact, both are based on the same principle of mean reversion and expectation of a reversal. But technically, they are not the same. With the Martingale strategy, the trader adds a larger trade size (double the former position) after each loss. However, in the double-down strategy, the trader only adds the same position size as the initial losing position.
In other words, the Martingale strategy increases the risk size more than the double-down strategy does. But both strategies increase risk exposure and stem from a psychological state of loss aversion.
Another variant is the scale-in strategy where you add exposure based on certain criteria.
Who invented the Martingale strategy?
The idea behind the Martingale strategy started many hundred years ago when it was introduced by a French mathematician, Paul Pierre Levy, in the 18th century. The Martingale strategy is based on the principle of probability and odds and establishes the premise that only one good bet is needed to turn your fortunes around.
The mathematician figured that there is a non-zero probability of getting the same outcome and that doubling the wager ensures that any winning bet offsets all the previous losses. He was later awarded a major award for his work in the mathematical field of probability.
Martingale strategy example
Let’s say a trader who uses the Martingale strategy buys $1,000 worth of a stock when it is trading at $50 per share. If the stock price falls in the following week and the trader buys $2,000 worth of the stock at $25, the average buying price falls to $30 per share.
Assuming the stock price decline more, falling to $12.50 per share, the trader buys $4,000 worth of the stock at that price. This takes down the average cost per share to $16.66. If the stock rises at this point to $19.05, the trader can successfully exit the trade and make a profit of $1,000 — which is equal to the initial amount invested.
This is just an example; it does not always happen that way. A stock can keep declining to zero if the company becomes insolvent and you might face a devastating loss.
Martingale strategy success rate (win rate)
The Martingale strategy has a high win rate. Generally, there may only be a few losers, but they are BIG. Theoretically, with an infinitely deep pocket, the strategy has a near 100% success rate, as all you need is one winner to get back all of your previous losses, so you must keep throwing in more money.
However, if the money supply is not adequate, a long enough losing streak could cause you to lose everything. You need an infinite supply of money to achieve 100% profitability — but it must be an asset like forex, which does not fall to zero.
Another benefit of forex is that if the trade is in the direction of a positive carry (using a low-interest rate currency to buy a high-interest rate currency) the swap payment can reduce the losses while waiting to get a winning trade. So, it might work better when going long AUD/JPY currency pair because the AUD tends to have a higher interest rate than the JPY.
Is Martingale the same as averaging down?
They are closely related but not the same. Averaging down, also known as scaling in, is investing a specific amount when the price of an asset you planned to buy falls. The amount invested at each trade is a part of the money already planned to invest in the asset. In this case, averaging down the entry price is a planned method of entry.
The Martingale strategy, on the other hand, is adding more positions when the initial position is losing. It is a way of avoiding losses by unwisely seeking more risks.
Does Martingale work in the stock market?
The Martingale strategy was initially developed for betting on any game with an equal probability of a win or a loss. But people now brought it into the financial markets. The stock market is not a zero-sum game (in the long run, but more or less zero-sum in the short run) and not as simple as betting on a roulette table.
Therefore, the strategy may be dangerous to apply in the stock market. Since stocks can fall to zero, a trader can lose everything even if he has an infinite supply of money. Also, given that stocks theoretically have infinite potential to rise, it may be dangerous to apply for short selling.
However, the strategy may work (long only) with a broad market index ETF, such as the S&P 500 index ETF — SPDR S&P 500 ETF (SPY), iShares Core S&P 500 ETF (IVV), and Vanguard S&P 500 ETF (VOO). These are unlikely to fall to zero, and the US stock market tends to go up in the long run.
Martingale trading strategy backtest
Now that you know the theory behind the Martingale strategy, it’s time to make a backtest of a Martingale trading strategy with strict trading rules and settings to check out the historical performance and statistics.
Benchmark strategy for Martingale
First, we make a pretty simple strategy as our benchmark:
- We buy at the close when the 4-day RSI indicator cross below 30.
- We sell at the close when the close is higher than yesterday’s high.
This is all there is to it. If we backtest that strategy on SPY (S&P 500) we get the following equity curve:
The 409 trades have an average gain of 0.64%. Annual returns are 8.68% and max drawdown is 23%.
Martingale trading strategy backtest
Let’s assume you want to change the strategy so that you employ only 33% of your equity when the 4-day RSI crosses below 30 and you add the rest (66%) when it crosses below 20 (you employ 100% of equity if it crosses through both levels on the same day).
What’s the result of this Martingale strategy? The equity curve and trading performance of the Martingale strategy look like this:
Just by the looks of it, it doesn’t look very good. The 409 trades still have an average of 0.64 per trade, but because we change the equity exposure we get a completely different result. (The number of trades is the same because we still enter at RSI(4)<30 even though we sometimes add more when RSI crosses 20 – which is still the same trade).
What happened when you used our simple Martingale method?
- Total gains go down (a lot) because we put less capital/equity to work.
- Because of a rare few losers when the RSI is low, we get a bit more erratic equity curve.
In other words, not a desirable result, but perhaps as expected.
List of trading strategies
We started this blog in 2012 and we have since then written many trading strategies that you can read for free. Please see our list of trading strategies.
Many of the strategies on the list are available in Amibroker code and all come with logic in plain English (plain English is for backtesting in Python) in addition to the Martingale strategy we did in this article.
For a list of the strategies we have made please click on the green banner:
These strategies must not be misunderstood for the premium strategies that we charge a fee for:
Martingale strategy video
We have also made a short video of this article:
Martingale trading strategy – summary
We don’t recommend using the Martingale method for trading but don’t confuse Martingale with a scale-in trading strategy, which occasionally is the smart way to enter a position.
We rather suggest the opposite of a Martingale trading strategy: be very careful and spread your equity into many baskets. Preferably you want your data-driven strategies to be uncorrelated to reduce risk.