What happened?

Friday, March 13, was a great day for shares of Xilinx (NASDAQ:XLNX)Cognex (NASDAQ:CGNX), and NCR (NYSE:NCR), with the three gaining 10.2%, 14.1%, and 15% to close out the week. Friday was a huge day for most stocks, with the S&P 500 and Nasdaq Composite gaining more than 9.2%. 

So what

Friday was on track to be a good day for most of the trading period, with the major indexes up around 4% about one hour before the close. However, a news conference by President Trump and a number of key officials announcing a number of big steps to help address the health and economic impacts of the ongoing coronavirus outbreak stoked a massive surge on Wall Street. 

By the close of trading, the indexes, along with many stocks including the three named above, closed out one of the worst weeks in U.S. market history on a positive note. The following chart shows just how quickly the market turned sharply higher late on Friday: 

NCR Price Chart

NCR Price data by YCharts.

Yet even with double-digit gains by all three, only Cognex shares finished the week above where they started, with Xilinx and NCR shares declining 4% and 19%, respectively. 

The market's treatment of NCR in particular highlights investors' worries over the COVID-19 pandemic, and how it is anticipated to significantly weaken the economy and potentially cause a recession. NCR makes equipment that serves retail and merchant applications, manufacturers, distribution, and a litany of uses that will see reduced demand under a recession. 

Cognex is heavily exposed to China, and while 2019 was a tough year there for the company, indications that COVID-19 diagnoses may be slowing should be seen as good news. Xilinx had already taken steps to cut costs earlier this year as its results declined last year, so much of the worst worry about that company could already be priced in despite the market's overall uncertainty. 

Frankly, we just don't know what will happen next. The past week was one of the most volatile in decades, with Friday's huge gains coming only one day after stocks fell by the most in a single day in more than 32 years. 

After a hugely positive reaction to the administration's announcements Friday, this weekend has seen expanded travel bans, with the UK and Ireland being added to the no-travel list beginning Monday. More than 2,700 COVID-19 cases have been confirmed as of late on March 14, a 1,000-case increase in just two days that has healthcare officials concerned the number of cases could skyrocket in the weeks ahead. 

And that could lead to a market reaction that erases Friday's big gains and takes stocks, including all three of these, even lower. 

Now what

No, that's not a hint that it's time to sell NCR, Xilinx, or Cognex. It's just a reminder that we are in uncertain times, and uncertainty will make for continued volatility. The best thing investors can do right now is a combination of sitting on their hands to avoid selling in the middle of a market crash, and looking for opportunities to buy

That's because things will eventually return to normal. Right now we just have no idea when that's going to be, and it's possible that means stocks -- including great companies like these three -- will fall even more before things start to turn for the better in a sustained way. But since none of us have any idea when the recovery will start, a combination of holding what you have and adding to it while the market is down will play to your favor.

It may take a quarter or a few, or even a year or more, before things really bounce back. But they will, and it's the investors who took this market crash as an opportunity to buy, not sell, who will come out ahead in the long term.