Did you know the stock market’s average return is about 10 percent per year? That’s what an investor buying an S&P 500 index fund could expect to earn over the long term.

Not too bad, right?

In fact, you will tend to beat more than 80 percent of professional investors in any given year using this simple buy-and-hold strategy. It’s one of Wall Street’s worst-kept secrets.

But while it’s simple, it’s not easy.

The problem is not what to do — just buying and holding the S&P 500 — but rather being able to stick to the game plan when the stock market gets volatile.

And no matter how things are going now, it will get volatile. So here’s your secret to outperforming most investors over the long term:

Know your temperament. How will you react when the market begins to tank and continues to go down?

How you answer this question is perhaps the best gauge of whether you can consider the next recession a threat or an opportunity. Know your temperament and then devise a plan to compensate.

A quick history lesson:

On Oct. 9, 2007, the S&P 500 hit a record high of 1,565.15. From there and for all of 2008, the market continued to tumble before bottoming at 676.53 on March 9, 2009. That was nearly a 57 percent drop.

Imagine you had a $100,000 portfolio at the market’s high point. Just 17 months later, your portfolio would be valued at $43,000 or so.

So after $57,000 in value disappears, what would you do with your shares?

• Sell them all and buy something safe

• Hold on for dear life

• Buy even more

If you hold or buy, you are primed to turn the recession into a moneymaking opportunity.

In fact, if you buy more when the market’s already down, you are likely to massively outperform the market’s long-term average of 10 percent annually.

But it’s going to take guts when media outlets and friends say you are crazy for buying as the market plummets.

Anticipate now how you will react when you’re staring down huge losses. That means understanding your temperament and then planning how to manage your reaction so you can continue to be a buy-and-hold investor and outperform the pros.

By the way, the S&P 500 has been steadily crawling back since 2009 and was trading above 2,700 as of June 4.

If you rode it out, your initial $100,000 investment would now be worth nearly $175,000.

James Royal writes for NerdWallet, a personal finance website.