It's getting downright ugly.

Each of the major stock market indexes plummeted on Monday, and when added to their previous losses, the losses brought them down about 19% -- just a hair away from the 20% declines that mark bear market territory. The majority of investors are no doubt nervous about the current state of their portfolios, yet savvy investors know that fortunes are made (and lost) in times like these.

It's important to remember one of famed investor Warren Buffett's most oft-quoted pieces of advice:

I will tell you how to become rich. Close the doors. Be fearful when others are greedy. Be greedy when others are fearful.

After such a brutal sell-off, here are five ways to keep your head and cash in as the market uncertainty remains.

Aerial view of Rio de Janeiro, Brazil

Aerial view over Rio de Janeiro, Brazil. Image source: Getty Images.

1. Invest in emerging market stocks

Stocks could still have further to fall, but emerging market stocks have held up better than U.S. equities, outperforming the S&P 500 by 5.75% last week, according to UBS analyst Mark Haefele. 

Long-term winners such as Latin American e-commerce and payments powerhouse MercadoLibre (NASDAQ:MELI) might fit the bill. The company notched new all-time highs just prior to the market meltdown. Fourth-quarter revenue grew by 57% year over year, driven primarily by the company's soaring fintech business. Its operational metrics were solid, with registered users and items sold growing 20% and 28% year over year, respectively.

However, it was the triple-digit payments growth that pushed the stock to new heights. Total payment volume grew 99% year over year in local currency as payment transactions increased 127%, and off-platform payments soared 176%.

The stock is down 25% from its recent highs -- on no company-specific news -- so this stock is a bargain compared to just three weeks ago.

2. Buy oversold stocks

When the stock market goes into panic selling, investors tend to "throw out the baby with the bathwater," as the old saying goes. This results in compelling opportunities that savvy investors can exploit. One such area is oversold stocks -- those with solid outlooks that are unfortunately caught up on the melee. Haefele highlighted the U.S. communication services sector, and one solid candidate is Netflix (NASDAQ:NFLX).

The streaming pioneer just closed out a banner year with global subscriber growth that grew 20% year over year, pushing revenue up by 31%. Even more impressive? Operating margins climbed to 13% in 2019, up from 10% in the prior year. This helps drive earnings per share up by 333%.

If consumers are faced with extended stays at home, or if a recession hits, they won't likely give up their streaming, which provides inexpensive, in-home entertainment. That explains why Netflix has held up better than the broader market, down just 8% compared to the market's 19% slump.

Businessman looking through a window shaped like a climbing graph.

Image source: Getty Images.

3. Buy long-term winners

Even in the face of the coronavirus outbreak, the digital transformation will continue, as "the COVID-19 outbreak has given an additional impetus toward remote working and engagement with online business models," which will likely accelerate as the health crisis continues. One way to benefit from that trend is by investing in Microsoft (NASDAQ:MSFT).

The technology giant's Office 365 commercial suite of products allows employees near and far to share and collaborate on files, schedule meetings, and even connect remotely using the company's Teams platform. Microsoft's commercial cloud segment is also instrumental in helping other companies be part of the digital transformation.

An additional benefit is the stock's dividend, which currently yields about 1.2%. Microsoft spends just 33% of its profits to fund the payout, leaving plenty of room for future increases.

4. Diversification can help

Those with a poorly diversified portfolio may be in for an even "bumpier ride" than other investors if the market goes into a prolonged slump, according to Haefele. Having a portfolio stocked with a broad assortment of equities and bonds can help take the edge off. That's because bonds have historically held up better and provided a safe haven for investors when the stock market tanks, helping to reduce the level of volatility in a portfolio.

It's never too late to further diversify your holdings for current -- or future -- stock market dips.

5. Improve your overall dividend yield

Another hedge against such inevitable stock market slumps is stocking your portfolio with quality dividend stocks. "Against this low-yield backdrop, investors will need to consider strategies that can enhance that yield in portfolios, such as dividend-paying stocks," Haefele said. There are plenty of solid dividend payers on sale right now for no other reason than the overall market dip.

One such blue-chip stock is Walmart (NYSE:WMT). As fears of a potential recession have grown, investors have sought the relative safety of the discount retailer. The stock held up remarkably well during the last bear market and has shed just 3% in recent weeks compared to the market's 19% plummet.

Walmart has boosted its dividend payout every year since 1974, with the most recent increase announced for 2020 -- so there's every likelihood those increases will continue. The dividend currently yields about 2%, and the company uses just 27% of its earnings to support the payout.