At some point in their lives, the majority of Americans may feel the sting of unemployment, even if only for a few weeks. While having an emergency fund can be a great resource to keep the bills paid without you having to dip into investments, it can be hard to continue building your long-term wealth during this time.

Here’s how a few experts say you should invest when you’ve lost your job.

5 ways to invest when you’ve lost your job

It can be nerve-wracking to think about investing when you’ve just lost your job, but it can also present an opportunity for future success as you seek your next gig. But you’re not going to win the long-term investing race next year or the year after anyway, so it’s absolutely vital that you take care of today’s problems first.

Here’s how wealth advisors suggest that you invest when you’re facing unemployment.

1. Invest in yourself

One of the potentially best investments you can make is upgrading your own skills, making you more employable later. That might cost money, but it may simply involve putting in the work.

“It can be something directly or indirectly related to your profession,” says Ed de la Rosa, certified financial fiduciary with Solid Ground Financial, a financial planner in Tampa. “For example, you may know Office products well, but how well do you know Google Suite products? Google offers a free certification course.”

Some newly unemployed people may decide it’s time to go back to school for another degree while they wait out a recession. Or they may decide it’s time to switch careers entirely, perhaps to something that is more in tune with their interests or desires.

Whichever way you go, investing in yourself could help you earn more later.

2. Stand pat on your retirement account

“The biggest mistake would be to cash out of your 401(k), especially if you are under 59 ½,” says De la Rosa.

A 401(k) provides valuable tax advantages to retirement savers, including the ability to defer or avoid taxes on your investments altogether. So it’s a great way to save for retirement.

While cashing your 401(k) may help you get back on your feet, it could derail your financial future. You’ll likely end up paying taxes and penalties, too. So experts advise that it should truly be a last resort, not something you do when you simply don’t want to make hard choices.

If you don’t access those 401(k) assets, you’ll also give them time to rebound from what’s likely a relatively low price. You’ll avoid the “buy high, sell low” actions of many investors.

“More importantly you want to make tough financial decisions from a position of strength, both financially and psychologically,” says De la Rosa. “So don’t make big decisions while you’re unemployed. If you have zero income coming in, don’t feel pressure to invest new funds.”

And while having a 401(k) with a former employer may leave a sour taste in your mouth, don’t be so quick to roll that account into an IRA, either.

The newly unemployed “should not make any quick decisions on their 401(k) or 403(b) or other retirement plans from previous employers,” says Morgan Hill, CEO and owner of Hill and Hill Financial, an investment planning firm in the Atlanta area. “Their new job may have a great new plan that they can move those funds into.”

And if it doesn’t? You still have the option of rolling over your retirement plan into an IRA.

3. Make safe short-term investments for now

If you just lost your job, it can make a lot of sense to keep your investments focused on potential short-term needs. And yes, investors have some great short-term investments, especially now.

“The biggest risk is that someone who is newly unemployed might misunderstand their cash flow needs and underestimate how much in savings they need and for how long,” says Shane Cummings, CFP, wealth advisor at Halbert Hargrove. “They might take cash that should be invested conservatively or just kept in a high-yield savings account and instead put it into a very risky and concentrated stock position that falls dramatically.”

Cummings suggests that everyone should have at least three to six months in emergency reserves, and more if your job is specialized or hard to hire. This cash can be a great candidate for a high-yield savings account, or even a short-term CD, if you time your cash needs carefully.

The more cash you hold in an emergency account, the more you can ride out a downturn in the market, giving stock or stock funds – potentially your best long-term gainers – time to recover.

“If you’re unemployed and need to find cash to cover living expenses, you could end up in a position where you’re forced to sell a stock at a huge loss simply to make ends meet,” he says.

But if you have plenty of cash reserves, a downturn can actually be an opportune time to take advantage of lower-priced stocks and set yourself up for solid returns later.

4.  Hang on to long-term investments for later

If, and only if, you have your short-term cash needs covered, you can think about investing in attractive long-term investments such as stocks or at least continuing to hold those you already own. But you must take a long-term mentality with stocks because of their high volatility.

“The history of the stock market shows us that over time equities are still one of the best asset classes to be invested in for long-term returns for those able to ride out market volatility,” says Cummings.

Investors looking for attractive returns should have a look at broad-based stock index funds, such as those based on the S&P 500 index. The index has returned an average of about 10 percent annually over long periods – but with substantial volatility along the way. So when investing in stocks or stock funds, use only money that you don’t need for at least three years.

Sticking to the long-term investing plan will probably serve you well over time, and it’s vital not to freak out when you see your investments fall in a down market.

“I find that the emotions that affect someone when unemployed have the biggest impact,” says Hill. “There is a tendency to overreact versus making thoughtful adjustments.”

If you’ve developed a solid long-term investment plan when times were flush, then it might need only modest changes during a downturn. Stick to what works in the long term, such as holding a well-diversified portfolio of stock investments, rather than making fear-based decisions.

Younger investors are well-suited to ride out the market’s volatility, given the long time until they need the money. However, those nearing retirement may need a different strategy, in particular because they’re susceptible to what experts call “sequence of returns” risk. That is, if the market falls right before they need to access funds, it could permanently hurt their retirement income.

Cummings recommends a more diversified approach to keep these near-retirees from losing too much. This process often involves adding bonds to a portfolio, since they tend to be less volatile than stocks and offer a steady stream of income over time, evening out the stocks’ performance.

Working with a financial advisor can help you implement strategies such as these. Bankrate’s financial advisor matching tool can help you find an advisor in your area.

5. Strategize how you’ll respond when re-employed

While searching for a new job can consume a lot of time, use the spare moments to consider how you’ll invest when you’re back earning a regular paycheck. For example, it can make sense to restock your emergency fund if you’ve had to tap it.

If you’ve reduced your expenses during your period of unemployment, it may make sense to keep your expenses low and put the savings into your 401(k) at your next job, says De la Rosa.

With this strategy, you may be able to take advantage of employer matching funds, helping you accelerate your savings even further. Once you’ve tapped out matching funds, many experts recommend contributing to a Roth IRA, another retirement account with valuable tax benefits.

Finally, with a new paycheck coming in, you can think about how you’ll invest for the long term and safeguard yourself from future downturns while building a comfortable nest egg.

Bottom line

Unemployment can be rough, but it doesn’t have to derail your wealth if you take prudent steps beforehand, especially loading up your emergency fund. The fund will let you sleep easier at night while allowing your high-return assets to roar back when the economy strengthens.

Editorial Disclaimer: All investors are advised to conduct their own independent research into investment strategies before making an investment decision. In addition, investors are advised that past investment product performance is no guarantee of future price appreciation.