To say that the stock market has been a rollercoaster over the last year would be a huge understatement. The market not only experienced one of its biggest downturns in history last spring, but it also set record highs just weeks later.

When the stock market is experiencing wild ups and downs, it can be difficult to determine which stocks you should really be investing in right now. While big names like Pfizer (NYSE:PFE) are appealing, it may or may not be the right time to invest.

Bottles of Covid-19 vaccine

Image source: Getty Images.

Chasing trends in the stock market

Whether you're a novice investor or have been involved in the stock market for years, it's tempting to invest in what appears to be the next big stock. Both Pfizer and Moderna (NASDAQ:MRNA) have recently announced the completion of successful coronavirus vaccines. Investing in either one of these stocks might seem like a good idea if you're predicting stock prices will boom in the near future.

However, it's important to keep in mind that successfully investing in the stock market means choosing stocks that will perform well over the long term. Short-term wins can be exhilarating, but long-term growth is one of the most critical factors to consider when investing.

This isn't to say that companies trending in the news at the moment are never wise investments. But it is important to make sure you're investing for the right reasons. Chasing popular companies simply because they're popular can be a recipe for disaster, so be sure you're looking at the big picture when deciding whether it's wise to invest in a particular stock.

Case in point: Despite Pfizer's massive announcement about the COVID-19 vaccine, the company's stock price actually fell in 2020. Even after the vaccine announcement near the end of the year, share prices dropped after an initial spike.

PFE Chart

PFE data by YCharts

What does this mean for investors? It means that although Pfizer may still be a good investment, it's crucial to avoid basing your decision to invest on a small snapshot of the company's history. 

How to invest for the long term

Rather than chasing trends, it's better to invest in companies with solid histories and bright futures. Of course, nobody can predict exactly how stocks will perform over the next month, year, or decade. But looking at the big picture can help you determine whether a stock will be a solid long-term investment.

A few factors to consider include revenue growth, earnings per share, and whether or not a company pays a dividend (as well as whether the company has consistently increased its dividend over the years). It's also a good idea to look at the industry a company is in to see how well that industry as a whole is performing. Taking multiple factors into consideration can give you a better idea of whether a stock is a solid investment.

It can be tempting to invest in companies that are hot at the moment, but that's not always the best investing move. Rather than buying a particular stock based on a single factor, it's better to look at the big picture to decide whether that investment will pay off over the long run.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.