It’s easy to be scared out of the stock market by major events like the EU referendum. The risk of permanently losing your capital seemed very real on Friday morning. Major FTSE 100 (INDEXFTSE: UKX) stocks lost 20% of their value in less than 20 minutes.

But the reality is that selling in situations like this is often the worst thing you can do. In just four days, the FTSE 100 has returned to its pre-referendum level of more than 6,300. Investors selling on Friday or Monday would have lost money needlessly.

Pay less, get more

When you buy a share, you’re buying a slice of that company’s future earnings. In most cases, good quality companies will achieve gradual earnings growth over long periods. This should be reflected in a rising share price and regular dividends.

The most important thing to remember is that violent short-term price movements usually reflect extreme market sentiment, not changes to company valuations. The value of big insurers like Aviva didn’t fall by 15% on Friday just because their shares collapsed.

Most good companies will survive and prosper whether we leave the EU or not. Buying stocks during a market correction can seem risky and even reckless, but it’s often quite safe. What’s more, it can be very profitable.

Profit from this hidden advantage

History shows that dividends are one of the biggest contributors to investors’ stock market profits. Dividends also enable you to get your hands on some cash without selling any shares.

The good news is that when a company’s share price falls, its dividend yield rises. For example, if a stock with a dividend yield of 4% falls by 20%, the dividend yield on offer will rise to 5%.

Over a period of 10 years, owning a stock with a 5% yield and reinvesting your dividends each year will produce a 63% return. That’s without any increase in the share price.

In contrast, a 4% yield that’s reinvested each year will produce a return of just 48%. On an initial investment of £10,000, that would mean a £1,500 shortfall. Over longer holding periods, the difference is even greater.

This is why falling share prices can make a stock more attractive to buy, as long as the business remains sound.

Picking the right stocks

The FTSE’s recovery masks the fact that the shares that make up the index have had a big reshuffle. Defensive global companies such as British American Tobacco and Unilever have risen in value. Big oil and mining stocks have also done well.

On the other hand, housebuilders and banks have suffered badly. They remain much cheaper than they were a week ago. Do these battered stocks offer a buying opportunity, or is this a warning of problems to come?

I don’t have space here for a full analysis, but I think it’s worth remembering that housebuilders have enjoyed a long, government-backed boom market in housing. Even after last week’s falls, they still look quite expensive relative to their book values and to historic earnings.

In contrast, banks are only just starting to emerge from a long downturn. They trade at a discount to book value and on low P/E ratios. History suggests banks could offer good buying opportunities for patient investors.

A short list of stocks to buy?

However, before you hit the buy button on banking stocks or any other shares, I urge you to consider this special report.

The Motley Fool's top analysts don't share my optimism about banks. They didn't include any banking stocks in their exclusive wealth report, 5 Shares To Retire On.

If you'd like to know which companies our experts believe could help fund your pension, download this FREE, no-obligation report today.

To get your copy, just click here now.

Roland Head owns shares of Aviva and Unilever. The Motley Fool UK owns shares of and has recommended Unilever. We Fools don't all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors.