“Stay the course.” “Tune out the noise.” “Focus on the long term.”

That’s the advice that experts typically play on repeat at times like these, when stock prices are volatile or can see big drops.

It is wise counsel for most people, since no one knows for sure which way the market or the economy will end up this year, and missing out on stock gains, even briefly, can put a big dent in your retirement savings. What’s more, over periods of 10 to 20 years or more, stocks have always bounced back handily after downturns, leaving investors who remained steadfast with far bigger balances than they had before the turmoil.

But what if you don’t have a decade or more to wait out a recovery?

For anyone who intends to leave the workforce in the next few years or who has recently retired, the current financial environment is perilous. If you’re still working, a recession could push you out of a job earlier than planned, cutting short the time you have left to save and extending the period you need those savings to last. And for both near and recent retirees, a big drop in stock prices increases the risk that you’ll eventually run out of savings.

“What happens to the market and the economy in those near and early retirement years matters disproportionately to the success of your entire retirement plan,” said Wade Pfau, a professor at the American College of Financial Services and author of “Retirement Planning Guidebook.”

That’s why financial experts often refer to this period — roughly the five years before or after you stop working — as the retirement danger zone, and urge people in it to be proactive about reducing their risks. Here are five steps they recommend taking now.

Build a cash cushion

When stock prices drop just as you start withdrawing funds to cover expenses, you have to sell more shares to meet the same spending needs. That leaves less money to grow back once the market recovers.

“It can dig a hole where your retirement account just can’t catch up anymore,” Pfau said.

Consider two new retirees with $1 million in savings. Both start withdrawing 4% a year (and then adjust for inflation) to help cover their bills during retirement, and although gains and losses vary from year to year, both on average earn 5% annually on their investments. The only difference: Retiree A has her best year, a 20% gain, in Year 1, while Retiree B has his worst year, a 20% loss, at the start.

The upshot? After 30 years, Retiree A has more money than when she started, a cool $1.6 million, according to an analysis by J.P. Morgan Asset Management. Retiree B, with far fewer dollars available to grow over time, runs out of money after about 22 years.

To avoid Retiree B’s fate, financial advisers suggest moving enough money into stable cash investments such as money market funds and short-term Treasury securities to cover how much you’ll need to pull from savings in the first two to three years of retirement.

Since you can’t predict the best time to sell, gradually shift the amount you’ll need from stocks to cash in equal installments over the next several months, advised Mark Whitaker, founder of Retirement Advice, a financial planning firm in Provo, Utah.

It’s also a good idea to identify other sources of income you could tap if needed, such as annuities, a home equity line of credit or even a reverse mortgage if you have substantial equity in your house.

An added benefit to this strategy: “It helps people disconnect emotionally from what is happening with the market,” Whitaker said. “It’s like, OK, the money I need to live on initially is protected, and my retirement plan is not contingent on what the S&P does this year.”

Fix your mix (a little)

You can also dampen the risk of losses in your retirement account by shifting more of your assets into bonds, which historically have lost far less money than stocks during downturns. That’s especially important if you haven’t rebalanced your investment mix after the sharp gains of 2023 and 2024, when the S&P 500 rose 26% and 25%.

You might aim to have enough money in bonds and cash to cover how much you need to withdraw from investments for five to seven years in retirement, suggested financial planner Clint Haynes, a retirement transition specialist in Lee’s Summit, Mo., and author of the book “Retirement the Right Way.”

Don’t go overboard, though, he cautioned. You still need to keep a substantial percentage of savings in stocks — perhaps 50% to 70% — to combat the other big financial risk for retirees: inflation. Over time, only stocks have been able to handily outpace rising consumer prices, increasing an average of 10% a year historically, which is more than double the gains of bonds and real estate and triple the return on cash investments.

“Inflation is a low drip, like boiling a frog: The impact kind of creeps up on you, but when it hits, it doesn’t feel good,” Haynes said.

Don’t fool yourself into thinking you can bail out of stocks now, then jump back in when the market stabilizes. Gains historically have come in unpredictable spurts, and the biggest advances often come within days of the worst declines.

If you missed the 10 best days over the 20 years from 2005 to 2024, you would have reduced your returns by more than 40%, according to J.P. Morgan; if you missed 30 of the best days out of the roughly 5,000 trading days during that period, you’d have lost money, after inflation.

Adjust your spending

Reducing your spending, even temporarily, will also help your money last.

If you’re still working, every dollar you don’t spend is one you can direct toward saving, to be better prepared if a recession or bear market hits. And if you’re already retired, every dollar you don’t spend is one dollar fewer you need to pull from savings when stock prices may be down.

Look at your discretionary spending and see where you can make a few strategic cuts.

“If you budgeted $5,000 or $10,000 for travel, maybe this isn’t the time for a big trip, or if you’re gifting to the kids or grandchildren, pull back a bit,” said Lazetta Rainey Braxton, a financial planner and founder of the Real Wealth Coterie in New Haven, Conn.

Or take a more systematic approach. Instead of following the standard guidance to keep withdrawals to 4% of the balance in your retirement account, then adjust annually for inflation, you might forgo the inflation raise when stock prices are falling, Pfau said. Or you can install so-called guardrails, limiting withdrawals to, say, 3% in bad years for stocks but taking out perhaps 5% when the market is surging.

Have a Plan B — and C

Taking action and being flexible in response to economic conditions can also help with the emotional toll of worrying about your money in the early years of retirement, said Teresa Amabile, a psychologist and professor emerita at the Harvard Business School and co-author of the book “Retiring: Creating a Life That Works for You.”

“Facing these uncertain markets and an uncertain economy, you can’t help but feel some anxiety, but our research found that exercising agency in making changes and practicing adaptability to unforeseen circumstances can help allay those concerns,” Amabile said.

One helpful exercise, she said: Think through three options for your lifestyle in retirement — your ideal, a scaled-down version that might be more realistic financially, and an even less costly option if economic conditions leave you feeling squeezed.

Maybe, for instance, you hoped to buy a second home in a warm location to escape to during the winter months. A scaled-back version might be renting a beach house instead for a month or two during the cold weather; a third version might be taking a shorter winter vacation or even downsizing to a smaller home to free up cash for travel.

“Plan scenarios that are all appealing,” Amabile said.

“Realizing that you have a variety of enjoyable options is what’s key.”

Work a little longer

If you’re still working, putting off your exit date for a while will give you more time to save and shorten the number of years those savings have to last.

“Working longer is a really powerful way to improve your retirement finances and get spending plan back on track,” Pfau said.

Already retired? You may still be able to postpone withdrawals from your savings, or at least take less money out, by finding a part-time job to supplement income from pensions or Social Security.

Of course, continuing to work isn’t an option if you’re retiring because of health problems or you were laid off and can’t find another job. Or you may simply be reluctant to change your schedule for a retirement you’ve worked and planned hard over decades to enjoy.

“Time is a currency, too, and it’s important to think about all of the trade-offs,” Braxton said. “Are you willing to give up on the things you wanted to do in your robust years without the pressure of an alarm clock? Because you never know what can happen, especially with your health.”

Rather than continuing to work, you might consider downsizing or cutting expenses more than you planned because the trade-off is worth it to you, Braxton said.

“The clearer you are about your vision for the life you want in retirement, and the reality of the financial options,” she said, “the better your chances of getting to a place where it all works out.”