The stock market is hitting new highs! No! It’s starting to crash! Wait! It’s up again! Investors are beginning to get whiplash from being whipsawed so many times. Betting it all on stocks has been a prescription for heartburn and mediocre returns for over a year. Let’s face it. The latest rally will probably be followed by another downward movement in the market. After all this drama, many investors are looking for a way to lock in their gains.

Stocks have been much kinder to speculators trading in and out of the market than to long-term investors. The S&P 500 recently reached record highs, but the index went up only about 6% during a year and a half of volatility. Look back, and you’ll see that the S&P 500 was already above 2,823 in January of 2018. Since then, the market produced two genuine corrections of over ten percent and significant losses this May. If you want to keep your gains, you can try to become a speculator or diversify your investments.

What most investors really want is a more predictable way to build wealth. Under the gold standard, bonds provided this. Today, you can still lock in your gains with a diversified portfolio. An equal mix of gold, stocks, and ten-year treasury bonds produced positive returns during every three-year period since 1971. Even better, the largest loss in a single calendar year was just 9.7% in 1981. Finally, this lower risk allocation managed to generate average returns of over 9.5% per year between 1971 and 2018.

Gold is the secret to more stable returns that most portfolios are missing. In the long run, gold alone produces a respectable return of over 7.6% per year. However, the greatest benefits come from diversification. Stocks and gold typically part company during major bear markets like 1973-1974 and 2000-2002. Even as Fed rate hikes depressed all asset prices last year, gold often rallied when stocks fell. The different patterns of gold and stock returns protect diversified investors from losing too much in any one year.

The roller coaster ride that stocks started on last year is probably just beginning. We can’t predict returns with certainty, but volatility tends to rise as bull markets age. The bull market in stocks is over ten years old, so it is the perfect time to buy gold. There’s no need to take losses today because stocks are up (if not by that much). More importantly, diversifying your investments will protect you from large losses in the future. You can keep most of your gains most of the time when you add gold to your portfolio.