The stock market has been on a rollercoaster of ups and downs so far this year, and some investors may be having mixed feelings about what that means for their strategy.
While the market is thriving right now (with the S&P 500 (^GSPC 0.38%) surging by more than 20% between April and June), there's still plenty of uncertainty about the future. Tariff policies could change in an instant, potentially triggering more volatility.
No matter what may be coming, longtime investor Warren Buffett has some timeless advice about investing during periods of uncertainty. Here are three of his best tips for protecting your portfolio while maximizing your earnings.

Image source: The Motley Fool.
1. Be greedy when others are fearful
One of Warren Buffett's best tips for investing amid volatility is to "be fearful when others are greedy, and be greedy when others are fearful." He offered this advice in a 2008 opinion piece for The New York Times, when investors were discouraged and pessimistic during the Great Recession.
He went on to explain that while investors should be cautious of weak companies, there's no reason to fear investing in strong businesses. "These businesses will indeed suffer earnings hiccups, as they always have," he writes. "But most major companies will be setting new profit records 5, 10 and 20 years from now."
Since that article was published, the S&P 500 has soared by a staggering 535% -- proving Buffett's point.
It's also important to note that after Buffett's article published, the market still had several more months of decline before it bottomed out. But those who rode out the storm and continued buying anyway saw the most substantial earnings over time.
If the market takes a turn for the worse in the coming months, that's your best opportunity to "be greedy." It may be a rough ride in the short term, but those who stick it out will reap the biggest rewards.
2. Don't be a stock-picker; be a business-picker
It's not enough to simply invest anywhere and hope for the best; you'll need to invest in the right places. In Berkshire Hathaway's 2021 letter to shareholders, Buffett explained his and then-business partner Charlie Munger's investing strategy.
"[W]e own stocks based upon our expectations about their long-term business performance and not because we view them as vehicles for timely market moves," he writes. "That point is crucial: Charlie and I are not stock-pickers; we are business-pickers."
Even if a stock has an enticing price and a history of earning above-average returns, that doesn't necessarily make it a good buy. Weak companies can still thrive when the market is surging, but those businesses will struggle to recover from economic instability.
If you invest in the wrong places now, it will be much harder to pull through a downturn. But by investing in strong companies with healthy fundamentals and a capable leadership team, your portfolio is far more likely to recover from tough times and experience long-term growth.
3. If you wait for the robins, spring will be over
It's tempting to wait until the perfect moment to invest, especially if you're worried about volatility on the horizon. But according to Buffett, waiting too long to buy can do more harm than good.
"I can't predict the short-term movements of the stock market. I haven't the faintest idea as to whether stocks will be higher or lower a month or a year from now," he writes in the Times article. "What is likely, however, is that the market will move higher, perhaps substantially so, well before either sentiment or the economy turns up. So if you wait for the robins, spring will be over."
During the Great Recession, the S&P 500 reached its lowest point in March 2009. But the recession itself didn't officially end until June of that year. In those three months alone, the index surged by close to 40%.
One of the best ways to maximize your earnings in the stock market is to invest consistently, no matter what the market is doing. Timing the market accurately is next to impossible, but if you invest regularly through all the ups and downs, you're far more likely to see positive returns over time.
Nobody knows what the coming weeks or months will look like for the stock market, but the more you can prepare now, the better off you'll be. By investing consistently in the right places, your portfolio can thrive no matter what's on the horizon.