This year has been a wild ride of volatility for the stock market, and it's likely a recession is looming. In fact, there's now a greater than 50% chance there will be a recession sometime in 2023, according to analysts from J.P. Morgan.

If you're feeling nervous about how the stock market will fare, you're not alone. While the market has been on an upward trajectory in recent months (with the S&P 500 up more than 6% so far this year), there could still be more turbulence ahead.

Fortunately, there are a few things you can do right now to keep your investments safer -- regardless of what the rest of this year has in store.

1. Keep a long-term outlook

When the market is shaky, it's easy to get caught up in the daily or weekly price fluctuations. But the short-term ups and downs aren't nearly as important as the market's long-term potential, which is incredibly promising.

Since 1929, the S&P 500 has experienced 21 separate bear markets -- not including the current one. On average, that's a bear market approximately every 4.5 years.

On the surface, that may not seem too encouraging. But the market has managed to not only recover from every single one of those downturns, but go on to see positive total returns.

In the past two decades alone, the economy has experienced some of the worst crashes and recessions in history, from the dot-com bubble burst, to the Great Recession, to the COVID-19 crash in March 2020. Despite everything, though, the S&P 500 is still up by nearly 180% since 2000. 

^SPX Chart

^SPX data by YCharts

There could be more volatility on the horizon, and there's always a chance that things may get worse before they get better. But if history indicates anything, it's that given enough time, the market will get through this slump.

2. Double-check your emergency fund

The best way to survive periods of market volatility is to simply hold your investments and wait for the recovery period.

If you sell your investments before the market rebounds, you risk losing money. Stock prices are lower than they've been in a long time, so if you pull your money out of the market now, you may end up selling your investments for less than you paid for them -- locking in those losses.

It's wise, then, to ensure you have a healthy emergency fund in times like these. When you have a few months' worth of savings stashed away, you can rest easier knowing you won't need to touch your investments in the event of a job loss or unexpected expense.

3. Stay invested (and keep investing)

If you have a strong emergency fund and some extra cash, it's worthwhile to keep investing -- even during periods of volatility. While this may seem counterintuitive, market downturns are one of the best times to invest more.

Not only are stock prices lower (meaning you can snag quality investments at a steep discount), but you'll also be in a fantastic position to see lucrative returns when the market rebounds.

For instance, say you had invested in Amazon in late 2008 -- when the stock bottomed out during the Great Recession. In the moment, that may have seemed like a terrible time to buy, as the stock had fallen by more than 60% from its peak.

However, over the following two years alone, you'd have earned returns of more than 370%. Within five years, those returns would have soared to around 935%.

AMZN Chart

AMZN data by YCharts

Of course, not all stocks will see Amazon-like returns. But many stocks haven't seen downturns like this since 2008, and buying throughout the market's low points is the best way to take advantage of the lucrative recovery period.

Investors have been through the wringer lately, which can be discouraging. But it's only a matter of time before the next upswing. By sticking it out through the rough patches, you can maximize your earnings while still keeping your investments safer.