Portfolio Boss

Moving Average Crossover: Rules, Pitfalls and How to Test It

Moving average crossover title card
Quick answer

A moving average crossover compares a fast price average with a slower one. A basic strategy buys when the fast average crosses above the slow average and holds until it crosses below. It's a simple way to follow trends. Sideways markets can trigger repeated entries and exits, so trading costs belong in the test.

The moving average crossover is one of the first trading signals most traders learn. It is simple, visual and easy to automate, which also makes it easy to misuse.

How a moving average crossover works

A moving average smooths price by averaging it over a set number of days. A crossover strategy uses two of them: a fast one that reacts quickly and a slow one that reacts gradually. A cross above is a bullish signal; a cross below is a bearish signal. Both describe the relationship between recent price averages.

Common versions

Version Fast / slow average Character
Golden cross / death cross 50-day / 200-day Slow, long-term trend signal
Medium-term crossover 20-day / 50-day More signals, more whipsaws
Price vs. one average Price / 200-day Simplest trend filter

Averages can be simple (each day weighted equally) or exponential (recent days weighted more), which reacts faster.

A basic crossover strategy

  1. Calculate the fast and slow moving averages each day.
  2. Buy when the fast average closes above the slow average.
  3. Sell, or move to cash, when it closes below.
  4. Hold the position until the exit signal; then stay in cash until the next entry signal.

The main pitfalls

  • Lag. Moving averages confirm a trend after it has started, so signals respond after prices have moved.
  • Whipsaws. In sideways markets, the averages cross back and forth, creating a string of small losses.
  • Cherry-picked settings. Choosing the exact pair of lengths that worked best in the past is classic overfitting.

How to test a crossover honestly

Test across many symbols and a long history, include trading costs, and check a range of settings around your chosen ones. If results collapse around the best combination, investigate why the strategy is so sensitive. Walk-forward testing adds another layer of protection.

Simple versus exponential averages

A simple moving average gives every day in the window the same weight. An exponential moving average gives more weight to recent days, so it turns faster when price changes direction. That speed is a trade-off. Faster averages get you in and out sooner, which can help at real turning points, but they also cross more often in sideways markets. Slower averages filter out more noise but give back more of a move before they signal an exit. Neither type is better in general; the right choice depends on what you are trading and how much whipsaw you can tolerate.

Reducing whipsaws

Whipsaws are the biggest practical problem with crossover systems. A few common ways to reduce them:

  • Confirmation delay. Require the crossover to hold for a few days, or on a weekly close, before acting.
  • Price buffer. Only act when the fast average moves a set percentage above or below the slow one.
  • Trend filter. Take long signals only when a broad index is in an uptrend.
  • Longer averages. Longer lookbacks can reduce signal frequency; measure the change in your test.

Each changes when the strategy trades. Compare the filtered and unfiltered versions to see whether fewer trades compensate for later entries or exits.

Where crossovers tend to work and where they struggle

Crossovers work best on markets that trend for long stretches, such as broad stock indexes during multi-year advances or declines. They tend to struggle on markets that move sideways for long periods or reverse sharply, because the signal is always reacting to what already happened. Applying the same crossover to many different stocks and ETFs is a good way to see whether an edge is general or limited to a few lucky symbols.

Using crossovers as a filter rather than a strategy

Many traders get more value from moving averages as a filter than as a complete strategy. For example, a stock selection method such as relative strength ranking can choose which assets to own, while a moving average rule decides whether to be invested at all. This splits the job in two: ranking chooses candidates, and the average sets a trend condition. The same idea is used to switch between stocks and a defensive asset when the broad market falls below its long-term average.

A testing checklist for crossover systems

  1. Test on a long history that covers trending, sideways and crash periods.
  2. Include commissions and slippage, since crossovers can trade often in choppy markets.
  3. Try a range of average lengths around your chosen pair, not just the best one.
  4. Check results on symbols the rule was not designed on.
  5. Look at the worst drawdown and the longest losing streak, not just the total return.

Keep a final period untouched while choosing settings, then evaluate the finished rules on that period.

Questions to ask before trading a crossover

  • How many signals does it give per year, and how many were false?
  • What was the longest stretch of losing trades in the test?
  • Would I still follow it after five whipsaws in a row?
  • Does it add something the rest of my portfolio does not already do?

Test moving average crossover rules in Portfolio Boss

PB includes a Moving Average Cross Over filter. Choose simple or exponential averages, their lengths, and whether one must be above or below the other. You can build the rule yourself and see what it contributes to a strategy.

You can also let the Divine Engine search for combinations of rules. That shifts your work from guessing the perfect indicator setting to reviewing candidates the computer has built and tested.

Portfolio Boss was built by trader Dan Murphy, who began trading in 1997. The purpose is to make useful research easier to put into practice. A familiar indicator is a starting idea; the trading rules, test results, and role in the portfolio determine what you do with it.

Put your next idea to the test, free

Turn an indicator idea into a strategy you can test, without learning to code. Portfolio Boss Evo is 100% free for life for the first 100,000 signups ($1,999 value). Download now. Advanced modules are paid.

Backtested and hypothetical results have limitations and do not guarantee future results.

Key takeaways

  • A crossover gives a clear entry or exit condition.
  • Stay invested between the entry signal and the exit signal.
  • Compare trading costs and whipsaws across nearby average lengths.
  • PB lets you build crossover rules or let machine learning search for combinations.

Get Portfolio Boss Evo free for life

100% free for life for the first 100,000 signups. A $1,999 value. No code, no credit card.

Download Evo Free
From the founder

Dan’s Take

A moving average is where plenty of traders start. Nothing wrong with that. But when I let machine learning choose, moving-average crossovers don’t show up nearly as often as people might expect. Other indicators often win in our tests. I don’t want to force my favorite rule into a strategy. I want to see what earns its place.

Frequently asked questions

What is a golden cross?

A golden cross is when the 50-day moving average crosses above the 200-day. The opposite, a cross below, is called a death cross.

Should I use simple or exponential moving averages?

Exponential averages react faster because they weight recent prices more. That can mean earlier signals, but also more whipsaws. Test both.

Do moving average crossovers still work?

They can capture large trends, but results vary a lot by market and period. They tend to struggle in choppy, sideways markets.

Can I start using Portfolio Boss for free?

Portfolio Boss Evo is 100% free for life for the first 100,000 signups ($1,999 value). Download now: https://portfolioboss.com/op/download-pb-evo/. Advanced modules are paid.

Get Portfolio Boss Evo free for life

100% free for life for the first 100,000 signups. A $1,999 value. No code, no credit card.