In Warren Buffett's latest letter to Berkshire Hathaway's (NYSE:BRK-A) (NYSE:BRK-B) shareholders, the Oracle of Omaha offered his long-term predictions for American stocks as well as some excellent advice that investors such as you and I can use to profit when things go badly.

Warren Buffett's long-term forecast for American stocks

Simply put, Buffett has no worries about the long-term prospects of American business, and therefore the stock market's performance. In his letter to shareholders, Buffett pointed out that the Dow Jones Industrial Average gained 72% from the end of the 20th century through the end of 2016.

Warren Buffett speaking to reporters at Berkshire Hathaway's annual meeting.

Image source: The Motley Fool.

He also remarked that "American business -- and consequently a basket of stocks -- is virtually certain to be worth far more in the years ahead." In one of my favorite comments from the letter, Buffett acknowledged that there will always be people with gloomy outlooks for the U.S. economy, but he added, "[H]eaven help them if they act on the nonsense they peddle."

Now, this doesn't mean you should simply invest in whatever company is making headlines today and forget about it. It's always important to stay up to date with the current state of all of your stock investments. And not all companies are created equal -- Buffett suggests that investors should stick with a "collection of large, conservatively financed American businesses" for the best chances of long-term success.

The market's path to success won't be straight up

Here's the key point: Although Buffett is convinced that investment gains will be substantial, he also says they will be "totally random as to timing."

Big market drops can and almost certainly will happen. As Buffett puts it, "[T]he years ahead will occasionally deliver major market declines -- even panics -- that will affect virtually all stocks. No one can tell you when these traumas will occur."

What to do if the market crashes?

Buffett wants long-term investors to remember two key points for when the market crashes, or if there's an all-out panic.

  1. Widespread fear is your friend. As an investor, you should love it when virtually all stocks are falling, as this is the time to look for bargains.
  2. Personal fear, however, is your enemy. Not only that -- it's completely unnecessary.

To illustrate this point, look at some of the investments Buffett made in the wake of the last market panic -- the financial crisis. As one example, during the worst part of the financial crisis, Buffett decided to invest $5 billion of Berkshire's capital in investment bank Goldman Sachs (NYSE:GS).

In exchange for his $5 billion investment, Buffett received $5 billion worth of preferred stock paying a 10% dividend, as well as warrants to buy 43.5 million common shares of stock by Oct. 1, 2013, with a strike price of $115. By the time the warrants expired, Buffett had made a total return of 62% over five years. He continues to hold shares of Goldman that resulted from the deal and are currently worth more than double the $115 exercise price.

The point is, the best thing you can do if the market crashes in 2017 -- or any other year, for that matter -- is to keep a cool head and remember the ultimate goal -- to buy solid American companies at fair (or downright cheap) prices. And in market crashes, you'll have plenty of opportunities to do just that. 

Matthew Frankel owns shares of Berkshire Hathaway (B shares) and Goldman Sachs. The Motley Fool owns shares of and recommends Berkshire Hathaway (B shares). The Motley Fool has a disclosure policy.