Retirement can be a stressful time as you transition from earning an income to relying on your savings. To ensure you have a financially secure retirement plan and avoid outliving your assets, you need a rock-solid plan.

Since retirement can last 20 to 25 years, it’s necessary to invest in stocks or stock funds. Unlike bonds that have a fixed payout, stocks can grow in value. That means dealing with the notorious volatility of stocks, potentially putting your income at risk.

To navigate this challenge, experts offer tips on how to handle a volatile stock market if you’re about to retire.

How retirees can navigate the stock market

When planning how to work through the treacherous stock market, near-retirees need to be careful not to try to time the market, thinking they can jump in and out at the best times. It’s harder than it’s ever been to decipher how the market will react to news these days, even for the pros, says Matthew Schwartz, CFP, advisor at Great Waters Financial in Minneapolis.

“Most investors slip up when they follow their human emotions,” says Peter Casciotta, owner of Asset Management & Advisory Services of Lee County in Cape Coral, FL. “Money and investment decisions, to most, are very emotional, like the decision to buy high and sell low.”

So it’s important to follow some key guidelines and then stick to them, even if the market’s volatility is painful in the short term.

1. Start early

The earlier you start planning for your transition to retirement, the more flexibility and opportunity you’re going to have. Even an extra five years can provide you a few more options and give you wiggle room, offering an opportunity to save more and set up your finances well.

The time frame is important, says Schwartz. To handle the volatile stock market, the answer is  different for someone planning to retire this year than in five years or longer.

“Ideally, folks are planning for this transition in advance of actually retiring,” he says.

Of course, if you’re starting decades out, you’re going to have the widest selection of options. If done right, you could live off dividends and never touch the principal in your stocks or funds.

2. Know your expenses

Your expenses form the baseline for the money you need, so the lower your expenses, the more flexibility you’ll have to withstand the volatile stock market. Regardless of how much money you have, if you can’t keep your expenses in check, you could run out of assets.

Casciotta advises clients to know what their lifestyle requires financially. From there individuals can “determine the rate of return necessary to meet your lifestyle needs so risk is minimized, and learn how to do it tax efficiently.”

“Adjusting one’s lifestyle and reducing their financial needs during poor economic times may be a strategy,” says Casciotta, but adds that it’s a strategy when individuals haven’t planned ahead.

3. Think holistically

Successfully navigating a fluctuating stock market isn’t just about gutting it out. Instead, it’s about having a well-developed income strategy that makes the volatility much less important to your immediate finances. So you want to consider all your income options and how they can fund your golden years while leaving stocks to fund growth over time so that you don’t outlive your assets.

Retirees have obvious options such as Social Security, though you’ll need to know what your benefit is going to be. It’s more flexible than people think, says Schwartz, pointing to the ability to withdraw your benefit in exchange for a higher one later and the ability to increase your benefit by 8 percent annually after you reach full retirement age.

Retirees may also have assets saved in retirement accounts such as a 401(k) or IRA, or in taxable investment accounts. Home equity is another often overlooked  but flexible option for retirees.

“One thing that is overlooked is home equity, especially with the recent run-up in real estate,” says Schwartz. Home equity might offer the liquidity to allow near-retirees to weather the downturn in the market and allow stocks to rebound.

4. Match your assets to your needs

Ensure that the investment time frame matches your financial goals.

This means you can set up fixed-income assets such as bonds and CDs when you have a defined time frame for the money. For money that you need at an indefinite time, then it makes sense to add in investments such as stocks and stock funds that can offer you growth.

Establishing an income base can help protect against longevity risk, allowing you to invest in growth assets such as stocks so that the portfolio can keep up with inflation over a longer term, says Schwartz.

“Don’t rely on the stock side of the portfolio for short-term needs,” he says.

5. Have some cushion to weather a downturn

Although bonds usually perform well when stocks are struggling, there are occasions when all asset classes suffer losses. In these instances, it can be good to simply have cash or cash equivalents such as CDs on hand. You won’t be exposed to market forces in the short term, and you’ll have cash as needed.

“It is vital to ensure you have cash available to meet your living needs for the next 18-24 months,” says Robert Gilliland, CRPC, managing director and senior wealth advisor with Concenture Wealth Management in the Houston area. “The last thing you want is to be forced to sell from investments that are down to generate cash to live on. Setting aside cash for a period of years can give your portfolio time to work and grow.”

6. Diversify your investments

If you’re investing in stocks, diversification offers a powerful way to reduce your risks while still having the growth potential of stocks. One of the easiest ways to invest in stocks is via index funds, and some of the most popular index funds are based on the Standard & Poors 500 index. By not putting “all your eggs in one basket,” you’ll reduce the volatility of your portfolio.

“Proper diversification is key,” says Schwartz. “In stocks, diversify by industry sectors and also internationally.”

Schwartz says that recently he’s seeing more allocation to U.S. stocks, but it’s important to have an allocation to international stocks, too, since some years they do better than domestic stocks.

7. Work with a pro

If you’re on the cusp of retirement and you haven’t planned much for it, it could be worthwhile to consult an advisor now. A pro can help you get your finances in order and maybe even devise a plan that helps you with minimum pain. Use Bankrate’s free financial advisor matching tool to find a financial advisor in your area.

“For investors who are about to retire amid a volatile stock market, I strongly suggest they seek professional advice regarding the positioning of investment assets in preparation for retirement,” says Casciotta. “As the saying goes, ‘You don’t know what you don’t know.’”

That plan could involve working longer, for example, but with the potential to drastically improve your retirement by staying employed just a little bit longer.

Bottom line

“Getting older or getting near retirement doesn’t mean that you have to invest conservatively. That’s not necessarily true,” says Schwartz. At the same time, your portfolio needs to be designed for your needs and risk tolerance, and the longer you give yourself to get the plan in order, the more likely you’re going to enjoy the kind of retirement that you’ve dreamed about.