Stocks Trading: Trend Following or Mean Reverting?

Need More Help? Book Your FREE Strategy Session With Our Team Today!

We'll help you map out a plan to fix the problems in your trading and get you to the next level. Answer a few questions on our application and then choose a time that works for you.

BOOK YOUR FREE STRATEGY SESSION NOW >>

The fact that the stock market tends to grow over the long term doesn’t necessarily mean that trend-following strategies are always the most effective for these financial instruments. In some cases, mean-reverting approaches can actually deliver better results.

So, how do you determine which strategy to use?

In this video, we compare trend following (which rides existing trends) and mean reverting (which takes advantage of pullbacks to the mean), testing both on the Nasdaq 100 to see which performs best—and under what conditions.

Here’s what you’ll discover:
•How stocks behave in the short and long term
•A head-to-head comparison of trend following vs. mean reverting
•Backtest results and key performance metrics

The tests revealed some very interesting insights! Watch the video to find out which strategy proved to be more effective—and in what market conditions.

Enjoy the video!

Transcription

Introduction: The Advantages of Stock Trading

Stock trading fascinates many traders because it is a conceptually simple instrument and, in my opinion, it offers a significant advantage—namely, a long-term upward trend.

In fact, when we analyze the major stock indices like the S&P 500 or the Nasdaq, we can see that their value has consistently increased since their inception.

Of course, we have also witnessed critical phases, including recessions and bear markets, but generally speaking, we can say that markets tend to rise over the long term.

Given this information, today we’ll delve deeper into the development of strategies for this instrument, examining the best approach and the most suitable timeframe—because I assure you, the answer is not as obvious as it seems.

The Challenge of Backtesting on the Nasdaq 100

To do this, we will consider the 100 stocks in the Nasdaq.

However, be careful—we will not take the current 100 stocks and backtest them from a certain date.

That would be somewhat like cheating, because we would be working with the past using information that we know today.

Let's take an example to better understand this point, because it’s crucial.

Suppose there is company A, which was included in the Nasdaq in 2020 and had outstanding performance from 2010 to 2020.

You understand that if I were to include it in a backtest before 2020, it would be incorrect, because it was only added to the Nasdaq in that year.

On the other hand, if there were company B, which was part of the Nasdaq in 2010 but later went bankrupt, I would still need to include it in the backtest for that specific period.

I know this is a much longer and more tedious process, but it must be done, because that’s the only way to get realistic results.

Now, let's move on to the chart and analyze the first strategy.

First Strategy: Mean Reverting Approach

Okay, here we are with the first strategy.

This is a simple long-term mean-reverting strategy.

In fact, we will apply this strategy on a weekly time frame, buying at the break of the lowest low of the last 24 periods and selling at the break of the highest high of the last 24 periods.

24 periods on a weekly timeframe represent approximately six months of trading.

Additionally, in this simple script, you’ll also find this function that I’ve included.

But in this case, we’re not interested in it because it serves only and exclusively to evaluate whether a given stock was part of the index on a specific date.

So, I have already inserted the strategy here in Portfolio Trader.

As you can see, Nasdaq stocks have been included with a weekly timeframe, and there are also stocks that have been delisted.

Another important thing to know is that a per-trade capital of $10,000 has been applied to this strategy.
So, we won’t be buying a single contract, but rather dedicating $10,000 to each trade.

Strategy Performance & Key Weaknesses

Alright, let’s take a look at the performance.

And here’s the equity line.

As you can see, it’s a positive result but not particularly satisfying.

It’s certainly positive because we are, after all, buying stocks that tend to rise in the long term, as we mentioned in the introduction to this video.

But as you can see, there are several negative phases, especially during the 2000–2001 recession, the 2007–2008 recession, and so on.

Let’s just say I wouldn’t have expected to see positive results with a purely long-only logic during those periods, but I still would have expected a more satisfactory outcome.

Now, let’s go ahead and analyze the Total Trade Analysis, and as you can see, we’re at about $470. This is certainly a good average trade—at least good enough to cover operational costs—but we need to see if we can improve this starting strategy.

Strategy Adjustment: Switching to Trend Following

Okay, going back to the previous script, I made two modifications.

Since earlier we were opening positions with a mean-reverting approach—meaning we were buying when the price hit the absolute low with a limit order—now, we’re doing exactly the opposite.

So, we enter with stop orders at the breakout of the highest high of the last 24 weeks.

In other words, we are taking the opposite approach. Instead of a mean-reverting logic, we are adopting a trend-following logic.

Comparing Mean Reverting vs. Trend Following

At this point, let’s take a look at the results.

And here is the equity line—definitely much better than the one we saw earlier.

In fact, this equity line is much smoother, and the drawdowns are significantly more contained.

As you can see, there are still negative phases, particularly during the two recessions or in 2022, a year when we saw stock markets decline. However, this is a much more satisfactory result.

Let’s also take a look at the average trade of this strategy.

As you can see, we are around $1,300—more than three times what we saw before, which, as you may recall, was around $400.

The theory says to buy when everyone is afraid, meaning when prices drop.

But as we’ve seen from the results, this is not a satisfactory approach over a long time frame.

On the contrary, the logic that has worked best is to include the most performing stocks in the portfolio while excluding the underperforming ones.

Testing on a Shorter Time Frame: What Changes?

But does the same principle hold true when considering a shorter time frame?

Let’s find out.

Okay, in this case, as you can see, I have included the same stocks as before but on a daily time frame.

Taking a look at the strategy, as you can see, it is essentially the same script.

Whereas before we were buying at the highs and lows of the last six months, in this case, we are buying at the highs and lows of the last five sessions—so roughly one week.

In fact, here, the number 5 on a daily timeframe roughly corresponds to one week.

I want to clarify that this was chosen purely for educational purposes.

Of course, you could try 5, 6, 7, or even 20 periods.

What I want to do is compare a strategy on a broad timeframe, such as six months, with one on a shorter timeframe, for instance, the 5-day period we've taken into account.

Since we previously observed that the best-performing strategy was a trend-following type, I have also coded a trend-following strategy in this case.

So, we’ll buy when the price breaks above the highest high of the last 5 bars and close the position when it breaks below the lowest low of the last 5 bars.

As always, we have set a capital per trade of $10,000, and now we will look at the results.

And here, as you can see, by applying the same strategy but using a shorter timeframe, the results we get are completely different.

In fact, this strategy is quite disappointing.

Look at the drawdown that occurred from the beginning of 2000 until the end of 2008.

Certainly, it has performed somewhat better in recent years, but still, it does not provide a solid starting point.

Let's also evaluate the average trade of this strategy, and as you can see, it's just $2.88.

If we consider commissions and slippage, we would completely erase even that small profit accumulated over the years.

So, this is definitely a non-tradable strategy.

Now, let’s proceed as we did before and apply the opposite strategy.

Instead of taking the breakouts of the highs and lows of the last 5 days, we will operate using a mean-reverting logic.

So, we will place limit buy orders when the price breaks below the lowest low of the last 5 days and close the position when it breaks above the highest high of the last 5 days.

I compile the strategy, and let's check the performance.

And here are the results for the new strategy.

At first glance, we are looking at a much more stable equity line—it generates profit, and the drawdown seen from 2000 to 2008 has been drastically reduced.

That said, it still performs poorly during the periods of 2001-2002 and also in 2008.

However, as you can see, at least it is making higher highs over time.

Let's analyze the average trade in this case. Before, we were at roughly $3, whereas now we are looking at an average trade of $53.

This is certainly not a very high value.

We are, perhaps, at the limit if we consider that it represents about 0.5% per trade, given the $10,000 capital allocated to each trade.

However, we must also consider that this is a very simple strategy—no filters have been applied, and no specific selection criteria were used for the stocks.

The only selection condition for the stocks was to check whether, on that specific day, a given stock was part of the index.

Final Thoughts: Which Strategy Performs Better and When?

As we have seen, applying a trend-following strategy over a broader timeframe on stocks can produce better results.

A possible explanation is that if a stock has been underperforming for an extended period, this could be due to its fundamentals.

In the short term, however, mean-reverting logic has proven to be more effective, likely because sudden price shocks caused by investor psychology are often followed by rebounds that can present profit opportunities.

Finally, I remind you that if you're interested in topics or analyses like the one shared in this video, you can click the first link in the description. There, you’ll find various useful materials.

That’s all for now—see you in the next video!

Need More Help? Book Your FREE Strategy Session With Our Team Today!

We'll help you map out a plan to fix the problems in your trading and get you to the next level. Answer a few questions on our application and then choose a time that works for you.

BOOK YOUR FREE STRATEGY SESSION NOW >>
Andrea Unger

Andrea Unger

Andrea Unger here and I help retail traders to improve their trading, scientifically. I went from being a cog in the machine in a multinational company to the only 4-Time World Trading Champion in a little more than 10 years.

I've been a professional trader since 2001 and in 2008 I became World Champion using just 4 automated trading systems. 

In 2015 I founded Unger Academy, where I teach my method of developing effecting trading strategies: a scientific, replicable and universal method, based on numbers and statistics, not hunches, which led me and my students to become Champions again and again.

Now I'm here to help you learn how to develop your own strategies, autonomously. This channel will help you improve your trading, know the markets better, and apply the scientific method to financial markets.

Becoming a trader is harder than you think, but if you have passion, will, and sufficient capital, you'll learn how to code and develop effective strategies, manage risk, and diversify a portfolio of trading systems to greatly improve your chances of becoming successful.