Investing during a down stock market can be challenging, especially when the selling pressure has been as indiscriminate as it has been in 2022. Almost every market sector has felt the pain, which implies investors have been panic-selling rather than making rational, long-term decisions.

It's the kind of environment that breeds opportunity for investors with cash to deploy, and who have the patience to wait out this rough period. After all, history is proof the stock market always bounces back with enough time.

Still, it's important to buy high-quality stocks with the potential to outperform. Here are two great examples, along with one that investors should steer clear of. 

The first stock to buy: Amazon

Amazon (AMZN 1.36%) is the world's largest e-commerce company, and it's had such a stellar run of growth over the last 25 years that even Warren Buffett, maybe the greatest investor on the planet, regrets not buying its stock sooner.

The secret to Amazon's success is diversification; it hasn't stopped at e-commerce, and now also dominates other industries like cloud computing.

Amazon Web Services (AWS) offers cloud solutions to 16 different industries, whether those companies need to simply migrate their operations online, or need the help of advanced tools like machine learning to supercharge their businesses. In the past year, AWS has been responsible for all of Amazon's operating income, so it's the profit engine behind the entire company. 

But Amazon also has a burgeoning advertising business, which has generated more sales than Alphabet's YouTube platform over the past year. And it's also dabbling in electric vehicles through its stake in up-and-coming producer Rivian Automotive.

Amazon has delivered $477.7 billion in total revenue in the last 12 months, it continues to diversify, and it has a track record that should give any investor confidence in its future.

The second stock to buy: Microsoft

Microsoft (MSFT 1.51%) is a household name thanks to its Windows operating system and Office 365 digital document suite, products that are used by billions of people worldwide. And like Amazon, this company continues to expand into new areas.

It has a cloud services business driven by Azure, which directly competes with Amazon Web Services, though often comes off second best. In any case, the cloud is now Microsoft's largest segment by revenue after Azure was founded just 12 years ago, which speaks to the company's ability to pivot into fast-growing opportunities. It's not always easy to steer a $1.9 trillion company in new directions.

Microsoft has also built a highly successful consumer hardware business. It's driven by products like the Xbox gaming console and the Surface line of notebook computers and tablets. Both have grown to become billion-dollar brands in their own right. The gaming side of the business is set for a big lift if Microsoft closes its $68 billion deal to acquire game development studio Activision Blizzard, which is currently under regulatory scrutiny. Activision owns popular titles like Call of Duty and World of Warcraft

With $192.6 billion in total revenue during the last 12 months, Microsoft is another company that will likely be around for decades to come. The current stock market volatility might simply be a speed bump for the company in the long run, so given that its stock is currently down 26% from its all-time high, now might be a great opportunity to buy in. 

The stock to sell: Robinhood Markets

Sometimes a bear market can expose weaknesses in certain businesses that were once hidden by a strong economy. Robinhood Markets (HOOD 2.62%) is a stock and cryptocurrency investment platform that was red-hot during the broader market volatility in 2020 and 2021, mainly on the back of trillions of dollars in U.S. government stimulus payments that flowed into the pockets of young, first-time investors. 

These investors used Robinhood's platform to trigger a frenzy in stocks that had a questionable chance of long-term success in normal market conditions, like GameStop and AMC Entertainment. Since Robinhood makes money from transaction fees, the more volume its customers generated, the better the company did. 

But in 2022, the enthusiasm for investing among Robinhood's young user base appears to have evaporated. Since the beginning of 2021, the number of monthly active Robinhood users has dipped 25% from 21.3 million to 15.9 million most recently. The amount of revenue the company earns from each user has plunged by a whopping 61% from $137 to $53 over the same period, suggesting customers are transacting far less often. 

But the steepest decline has been in Robinhood stock, which has collapsed from an all-time high of $85 to just $9 as of this writing. The pain might not be over; the company still faces regulatory concerns that could affect the way it earns revenue, and force it to adjust its gamified smartphone app that could be encouraging risk-taking. 

All in all, this isn't a stock investors want to take a chance on during shaky market conditions.