Is Buying Stocks Trading at 52-Week Highs a Profitable Trading Strategy?

About Beyond The Charts

Welcome to the Trade Risk’s brand new educational series, Beyond the Charts! It is designed to give you insights into our research process, which for nearly a decade has helped fine-tune our expertise and products, such as the market-beating Merlin trading strategy.

We start by asking questions as broad as, “Is there really such a thing as a Santa Claus rally?” to as specific as,”does buying a breakout after a particular type of consolidation lead to profits?” We then research our answers by gathering historical market data, writing code, and analyzing the results.

We hope the technical tools and code we’ll share with you throughout this series will help you become a more informed investor and, please note, the conclusions we draw throughout this series should be seen only as a starting point to additional independent research.

Today’s experiment

In this episode, we’re digging into stocks that are breaking out to new 52-week highs to find out if buying them can lead to profitable trading results. The question we are setting out to answer is: Can buying stocks setting new 52-week highs lead to a profitable trading strategy?

What are 52-week highs?

52-week highs is a term used for stocks that are trading at their highest price over the past one year. The list of stocks at 52-week highs is a very popular watchlist that lots of investors track on a daily basis. The stocks that show up here are usually pretty well-known and highly mentioned across FinTwit and financial media sites.

Is Buying Stocks Trading at 52-Week Highs a Profitable Trading Strategy? - Image of Yahoo 52w high list

Example of Yahoo Finance’s daily 52-week high watchlist.

Today, we are going to code a strategy to see what all the fuss is about. Can we profit from these stocks as soon as they start showing up on the 52-week high list?

Tools & resources used in this experiment

  • NinjaTrader 8: This is the backtesting platform we’ll be using to generate our signals and test our strategy.
  • Microsoft Excel: After we run our strategy in NinjaTrader, we’ll export the reports to Excel and analyze results.
  • Norgate: This is where our data comes from for this experiment and it’s our recommended source for building and testing strategies (affiliate/referral link).
  • Github: All of the strategy code can be found and downloaded here.

The in-depth tutorial

The following video lesson is where we go into all of the detail setting up the experiment, writing the code, and using our various tools and programs. If you want the in-depth walkthrough, we recommend continuing from this point on with the video. We also have timestamps in the description of the video in case you want to jump around.

How we constructed the 52-week high trading strategy

The strategy is composed of five key methods:

  • OnBarUpdate(): the main strategy method.
  • BuySellRules(): defines the trading rules:
    • Enter a long position when today’s price is greater than or equal to the 252-day high and we have no current holding.
  • ClosedAtFiftyTwoWeekHighs(): returns a true or false value depending on whether or not today is a new 252-day high.
  • ComputeShareSize(): calculate the number of shares to purchase using 100% of the current account equity.
  • OnExecutionUpdate(): logs the trading activity when buys and sells occur and keeps track of running performance.

How we set up the 52-week high trading strategy backtest

52-week high buy and trend follow Parameters
Testing universe Dow Jones Industrial Average Components
Timeframe Daily
Dates tested January 2000 to August 2020
Backtest 1 5% trailing stop loss
Backtest 2 10% trailing stop loss
Backtest 3 15% trailing stop loss
Slippage 2 cents

 

52-week high strategy backtest with 5% trailing stop loss

In our first backtest, we simulate a 52-week high trading strategy that buys stocks after they close at fresh 52-week highs and then use a 5% trailing stop loss to exit the position.

No profit targets, we only exit the position after the stock falls 5% from our entry price or its new highs price after it began working in our favor.

Here were the results:

Is Buying Stocks Trading at 52-Week Highs a Profitable Trading Strategy? - Image of Backtest Results 1

Not sure how to interpret some of these measurements? Head on over to our trading system performance glossary.

Nearly 2,000 trades across 20 years and a 38.40% win rate with an average 6.04% winning trade and a -3.06% losing trade. Not wildly profitable but it was still a positive outcome.

52 week-high strategy backtest with 10% trailing stop loss

The next test we ran was increasing the stop loss distance to 10% to see how much of an impact that has on results. Right off the bat, we noticed a big difference in the total number of trades, as they got cut in half down to 905 from 1927:

Is Buying Stocks Trading at 52-Week Highs a Profitable Trading Strategy? - Image of Backtest Results 2

We also observed a higher win percentage of trades, a larger average win-to-loss ratio, and most importantly, more net cumulative profit.

52-week high strategy backtest with 15% trailing stop loss

In our final test, we decided to increase the stop loss one more time to 15%. Once again, we observed fewer trades, a higher percentage of profitable trades, and a bigger win-to-loss ratio at just over 3 to 1:

Is Buying Stocks Trading at 52-Week Highs a Profitable Trading Strategy? - Image of Backtest Results 3

Also, take a look at the largest three winners from this test: over a 200% gain was captured thanks to having those wide stop losses, which helps avoid getting stopped out on routine price corrections.

Is Buying Stocks Trading at 52-Week Highs a Profitable Trading Strategy?

Yes — in all three of these tests we observed a net profitable outcome with each subsequent backtest more profitable than the prior. Buying stocks at 52-week highs is a form of momentum and there’s lots of evidence and research out there that supports this factor despite the counter-intuitive nature of “buying stocks at highs”.

Because our tests were limited to the Dow Jones Industrial Average components and a 20-year testing period, expanding the tests beyond this set of stocks and time horizons would be the logical next steps to build more confidence in this type of strategy.

While conducting this experiment, we also had two additional takeaways:

  • Evidence shows that wider stop losses have the potential to improve overall results.
  • A trader will need to be able to endure long stretches of sideways (no performance) for months and even years at a time if they plan to trade this type of strategy. This is something we discuss more in the video.

I hope you enjoyed this month’s experiment.

Were these results surprising to you? Do you trade breakouts, momentum, or 52-week highs? I’d love to hear your feedback and thoughts in the comments below.

Good luck out there!

Enjoy what you read? Share it below and be sure to tag @thetraderisk.

Evan Medeiros

Evan is the founder of the Trade Risk. With 20+ years of coding experience and a B.S. in computer science, Evan brings a systematic discipline to investing in the stock market.

Don't miss out on more educational articles just like this!

Please enter your name.
Please enter a valid email address.
Something went wrong. Please check your entries and try again.

Leave a Comment