If you’ve ever sat up late at night watching tv, you may have seen an infomercial for software to become a day trader.
They make trading sound so simple. Buy when a green arrow appears on the chart. Sell when a red arrow pops up.
You’re snickering right now because you already know it doesn’t work.
Yet so many traders talk about moving average (MA) crossovers in a similar way.
Put a shorter time period MA (like 21 bars) on a chart and wait for it to cross above longer one (say, 50 bars) to buy. Do the opposite to sell.
So how well does it really work?
Let’s jump in and find out…
Testing the Fabled Moving Average Crossover
My 21/50 moving average crossover example above is a semi-common one people use.
Of course there are others, like the 5/8, the 8/13 and the 13/21.
5, 8, 13 and 21 are all Fibonacci numbers, so people believe they have special powers.
That’s probably a self-fulfilling prophecy since so many people use them. But that’s a test for another day.
On to the rules!...
The Trading Truth Test Setup
Market: the S&P 500 index (using SPY to trade it)
Timeframe: Jan 1, 2013 to January 31, 2023
Bar interval: 30 minutes.
I chose 30-minute bars instead of the 2-minute or 5-minute bars many day traders use, just to smooth trends more. The less we can get caught in chops, the better.
Moving averages: 21 and 50 bars (simple moving averages, meaning every gets equal weight, unlike with exponential)
Starting Equity: $25,000
Max % of Equity Per Trade: 3%
Commissions, fees and taxes. To keep things super simple, we’ll assume these are all zero.
That’s borderline-realistic if you’re trading in a retirement account with a broker not charging commissions (you’d still have to pay exchange fees).
The A/B Test Rules
Rules for Test A
This is the classic moving average crossing strategy.
Whenever the 21 MA crosses above the 50 MA, buy.
And every time the 21 MA crosses below the 50 MA, sell.
That means, we exit whatever trade we’re in when we get the opposite signal… and then jump in going the other direction.
Easy fo sheezy.
Rules for Test B
Everything is the same here, except for when we’ll take profits and losses.
For this bad boy, we’re gonna use the 21-bar average true range (ATR) as both a trailing stop-loss and a trailing take-profit.
Specifically, we’re using twice the 21-bar ATR (based on the previous bar’s closing price) for extra wiggle room.
If we’re still in a trade when we get a new entry signal (MA crossover), we don’t take the trade. ‘Cause we’re rebels like that.
One other quirk for Test B: if we hit a take-profit level in the same bar as a stop-loss target, I assumed we took the profit first. It didn’t make much difference overall, as we’ll see…
The Test Results
Before we see how Test A did vs Test B, the real baseline is just ye ol’ Buy and Hold.
If you plunked your money into the S&P 500, your money would be worth 2.86 times as much by the end. Not bad for doing nada.
So how did Test A do?
No bueno. The ending equity after 10 years was only $25,091.74, which is barely breakeven. The one bright spot is the max drawdown, at 5.0%.
It’s not hugely surprising, since MA crossover strategies are highly prone to losses when the market is chopping around instead of trending. And the market sloshes around way more than it trends.
This pure strategy (only exiting a position on the next crossover) also tends to give back most profits, since it waits so long to exit.
Given the take-profit targets and trailing stop-losses in Test B, how did we fare there?
We ended with $27,261.39, a 9.0% return.
Definitely better, especially given the 1.9% max drawdown, but nowhere near as good as buying and holding — especially when you factor in all the trading you’d have to do.
What to Test Next
Using some kind of trend indicator, like Super Trend or Linear Regression, to filter entry signals could help reduce losses.
Picking a different market might also get us better results. For example, I saw someone on Youtube say the EUR-GBP forex market works well for MA crosses.
Testing longer-period moving averages would also smooth the price action more and be less likely to cross as much in ranges.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.