Are you struggling to find quality stocks to buy right now? With the market at around all-time highs, it isn't easy to find good investment options. The danger of buying shares of a soaring stock is that it could be at or near its peak. And if that happens, your return on the investment can be limited -- or negative -- even if the underlying business isn't bad.

Below, I'll cover three effective strategies I've used to identify stocks that are potentially undervalued. Whether the market is red hot or struggling, they can be effective in either scenario. 

A family meeting with an advisor.

Image source: Getty Images.

1. Finding large gaps between trailing and forward earnings multiples

The price-to-earnings (P/E) ratio is a useful multiple that you can use to compare stocks. The problem is that even one bad quarter can negatively impact this number. Whether it's a big acquisition or the coronavirus pandemic, a company's results can look significantly worse than they otherwise should. One way to find this type of discrepancy is by comparing the trailing P/E, which looks at a company's earnings over the past 12 months vs. its forward P/E, which factors in the earnings that analysts expect from the business over the next year.

A stock that trades at a high trailing P/E but a low forward P/E is one that could be undervalued. With soft earnings numbers, its trailing P/E won't look so great. One stock that you can find using this approach is healthcare company Merck (MRK 1.22%). The stock's trailing P/E is over 35 but its forward P/E is less than 15. The drugmaker's revenue of $48 billion in 2020 was up just 2.4% from the previous year and net income of $7.1 billion declined by 28%. 

Management says that without the negative impacts of the pandemic (people have been forgoing regular care amid COVID-19 and even cancer diagnoses declined significantly last year), the growth rate for the top line would have been closer to 9%. Now, with vaccination rates increasing, there's hope that COVID-19 will be less of a disruptor in the future for the healthcare industry. And that's why Merck could be an intriguing option right now and a strong recovery play. In addition, with the recent spinoff of Organon, which focuses on women's health, Merck expects to benefit from operating efficiencies of $500 million this year and $1.5 billion in total over the next three years.

Merck is an example of a company that may look overvalued right now but could be a much better buy over the next 12 months.

2. Using the Relative Strength Index to find oversold stocks

One technical indicator I use to find value is the Relative Strength Index (RSI). It looks at a stock's price movement (typically over the past 14 days) and compares its losses and gains over that time. As the losses significantly outweigh the gains, the number gets smaller. On a 0-100 scale, once it falls below 30, a stock is considered to be oversold. It is a momentum indicator that can be useful because it can identify a situation where investors have been overly bearish on a stock of late. It doesn't mean that every stock will turn around, but for pre-vetted companies on your watch list that fall into oversold territory, it can be a sign that now might be a good time to buy.

Using this criteria, you can find a solid growth stock like beverage giant The Boston Beer Company (SAM -0.52%), which has fallen sharply since the release of second-quarter results in July when its numbers fell short of analyst expectations. The growth in its hard seltzer segment simply wasn't as strong as it was in the past, and investors may have been overreacting to what still is a promising investment. A number of analysts see the stock rising over 70% within the next two years

RSI isn't a surefire way to find a winning stock; some companies fall in value sharply for valid reasons and their businesses could be in trouble. But if you've already reviewed a company and know it is a quality investment, using RSI can be a way to help zero in on the right time to buy it as oftentimes negative press can weigh a stock down more than it should. For investors who can look past that, it may create an attractive buying opportunity.

3. Buying on bad news

Investing in a company that has been receiving negative press -- and is down as a result -- is another way you can find some value. It may end up leading to a stock that falls into oversold territory, but it's not always a steep enough decline to get there. Here again, context is important. If the negative press involves the company's core business and its outlook for the future, that could very well be a problem. But if the prospects for the business remain strong, it can be worth buying amid the controversy.

One example here is Trulieve Cannabis, which is down sharply from its 52-week high. The maker of cannabis products has been struggling of late not because of poor results or even anything the business is doing wrong. Rather, shares have been tanking because the husband of the company's CEO was convicted on multiple charges. Even though there's no reason at this point to suggest Trulieve is in any trouble, the stock has still felt the effects of the negative press. For a cannabis company that is a major player in the growing marijuana industry, now could be a prime time to consider buying shares of the business.

Bad news can appear concerning over the short term but a distant memory years later. In 2018, when a privacy scandal involving social media company Facebook and consulting firm Cambridge Analytica came out, investors could have bought shares of Facebook for around $150 in the days and weeks following the news. Today, the stock trades at more than double that price.

The next time you see a negative headline on the news involving a business, consider whether it will impact its long-term growth prospects and ability to generate a profit. If it doesn't and the stock is down heavily because of the press, that could be a sign that it may be worth taking a contrarian stance on it and buying shares even as it falls in value. It may be a tough decision, but it's one that can pay off later.