Attention retirees. You’ll need to take steps to ensure that your required minimum distributions (RMDs) are managed from your IRA and 401(k), if you have reached 70-1/2 or will soon. Unwary retirees who leave it too late to withdraw their annual minimum distributions can fall prey to stock market declines, as they did in 2018.

Let’s look at what you can do to avoid this unpleasant surprise.

The following accounts are subject to the RMD rules: deductible IRAs and SEP-IRAs. SIMPLE IRAs, Roth 401(k), Roth 401(k), Roth 403(b), plans for non-profit organizations, and 457 (b) plans government employers. The RMD rules don’t apply to Roth IRAs, but Roth 401 (k), Roth 403(b) and Roth 457 plans. If you own a Roth version one of these plans, and you want to avoid the RMD regulations, you will need to roll your account over to a Roth IRA.

Participation in these accounts is required if you reach 70-1/2 years old by the end a calendar year. You must make a minimum withdrawal before Dec 31st of that year to include it in your taxable income. There is a one-time exception to the rules that applies to the first year. You can only wait until April 1st the next year to withdraw your funds.

You can withdraw the maximum amount from one IRA if you have multiple IRAs that are subject to the RMD rules. You can’t do this for your 401(k), 453(b) or 457 accounts. You must withdraw the minimum amount from each account in those instances.

Your minimum withdrawal amount is calculated at the start of each calendar year. Divide your account balance at year’s end by your expected life expectancy to find the amount. This is according to IRS Publication 590B. To determine the minimum amount that you can withdraw, you simply add a percentage of your account’s value at year-end to get it. For help in calculating the amount, consult your IRA administrator or 401(k), who may have a free online RMD calculator. FINRA also offers an online calculator.

The RMD rules are important to follow. If you withdraw less than the RMD, the IRS will apply a 50% penalty. Another thing to remember: You can withdraw more than the RMD without penalty.

You have the whole year to withdraw from your account. However, many retirees wait until December to withdraw the minimum amount. This is where the problem lies.

Many retired people who waited until December 2018 in order to withdraw their last year’s earnings might have been shocked by the amount of money they needed to pay to comply with RMD rules. Because even though the stock markets dropped in 2018, which could have led to lower account balances, the withdrawal amount was calculated based on account value as of December 31, 2017. The strong returns of 2017 may have prompted this amount to be higher.

This led to some retirees being forced to dispose of depreciated assets in order to comply with RMD rules.

Retirees who waited to withdraw their funds until the last moment were often rewarded. The S&P 500 had nine consecutive calendar years of positive returns in previous years. However, that winning streak ended in 2018, and retirees who waited too long to withdraw their funds were often left behind.

You have a maximum of a year investment horizon. This includes the amount you withdraw for each calendar year. When you have a shorter investment horizon, conventional investment wisdom advises that you should preserve principal. You can withdraw the money as soon as possible to avoid market risk. This will allow you to use the money throughout the year without worrying about the stock market’s decline.

Some financial institutions allow you to set up an RMD payment autopilot and have it paid according to a schedule you choose. You can avoid costly errors by not triggering the payment.

You could argue that it is better to keep your investments invested for as long as you can. You would have nine years of positive returns if you waited to withdraw your funds until December. An unpleasant experience in 2018 would have been the price you paid for your strategy.

That’s the main point: Make a conscious decision about your investments. Decide whether you want your RMD amount to be withdrawn as soon as you can to avoid being whipsawed, or if you are willing to accept a setback to keep your savings invested for as long as you can.