The stock market has been rocked by high inflation and rising interest rates this year. The broad-based S&P 500 and the tech-heavy Nasdaq Composite have fallen for three consecutive quarters, marking their longest losing streak since the tail end of the Great Recession in 2009. Both indexes have dropped into a bear market with the S&P 500 currently 22% off its high and the Nasdaq Composite down 31%.

Losses of that magnitude can leave investors feeling uncertain or even fearful. Those emotions often lead to poor judgment, and that can result in lasting damage to your portfolio. Fortunately, Warren Buffett and Peter Lynch have imparted some relevant wisdom over the years, and investors would do well to consider their advice.

Advice from Warren Buffett

Warren Buffett is often called the "Oracle of Omaha," a reference to his uncanny stock-picking abilities and his residence in Nebraska. Buffett built that reputation over several decades, using Berkshire Hathaway (BRK.A -0.30%) (BRK.B -0.26%) to fund his investing activities. Berkshire stock is up more than 3,600,000% since he took the helm in 1964, and the company has grown into a $600 billion behemoth. Not surprisingly, Buffett has become a sort of North Star for many investors.

During the Great Recession, Buffett wrote an opinion piece for The New York Times, and one quote, in particular, has become part of investing lore. He first mentioned the abysmal state of the stock market, then went on to say, "A simple rule dictates my buying: Be fearful when others are greedy, and be greedy when others are fearful." Those words have been repeated countless times since then, but they are especially relevant in the current bear market.

Fear is everywhere right now. Inflation hit a 40-year high earlier this summer, interest rates are rising at a pace not seen since the 1980s, and several other scary things -- geopolitical conflict, supply chain disruptions, and pandemic lockdowns -- have left the financial world in a state of alarm. But historical data suggests bear markets are the best time to buy stocks, and Buffett's words echo that sentiment.

To be clear, the stock market downturn may drag on for months or even years, but Buffett has consistently advocated for a long-term mentality. In his op-ed piece, he noted investors were right to be worried about businesses in weak competitive positions, but "fears regarding the long-term prosperity of the nation's many sound companies make no sense." And there are plenty of sound companies around today.

Advice from Peter Lynch

Peter Lynch became an investing legend while managing the Magellan Fund at Fidelity. Under his stewardship, the fund earned an annualized return of 29.2%, growing more than twice as fast as the S&P 500. That took place between 1977 and 1990, a period in history defined by global oil shocks, rampant inflation, and high interest rates. Sound familiar?

Lynch led the Magellan Fund for just 13 years, but he battled two bear markets and six market corrections during that time. That makes his outperformance even more impressive, and it makes his opinions all the more credible. With that in mind, Lynch once said, "The real key to making money in stocks is not to get scared out of them."

The stock market is currently in a state of disarray, and many investors may be tempted to cut their losses by cashing out. But I think Lynch would recommend the opposite. He once said, "A correction is a wonderful opportunity to buy your favorite companies at a bargain price."