Corporate earnings are expected to pick up by the end of the year. Above, traders work on the floor of the New York Stock Exchange, April 28, 2016. REUTERS/Brendan McDermid

Banks like Goldman Sachs were hammered by turbulent markets and skittish investors. Retailers like Macy’s tumbled as international buyers kept their wallets closed. Apple recorded its first revenue decline in 13 years.

For corporate America’s bottom line, there hasn’t been a worse quarter since the financial crisis. For the more than 90 percent of companies that have reported, earnings haven fallen 6.3 percent from the year before.

Although the tone of quarterly earnings season has been distinctly negative, that doesn’t mean we’re spinning into recession. In fact, analysts are optimistic that earnings will recover to their previous levels throughout 2016 as pressures from energy prices and exchange rates abate.

Global factors “have had extraordinary moves over the last few years and outsized impacts,” Deutsche Bank Chief Global Strategist Binky Chadha wrote in a note to investors Thursday, spreading particular pain to the energy, financial services and technology sectors. With energy prices rising and the U.S. dollar falling, he wrote, “a significant boost to earnings is building.”

Posting earnings gains in the months to come shouldn’t be too high a hurdle for companies, given the depth of the declines in late 2015 and early this year. The first quarter of 2016 marked the sixth period in a row of quarterly declines — the longest period of consecutive drops outside of a recession, as Goldman Sachs noted earlier this week.

But despite the lackluster environment and dour projections, first-quarter earnings have actually provided some good news. “Results were modestly better than expected, clearing a very low bar,” Goldman Sachs analysts led by Chief U.S. Equity Strategist David Kostin wrote. Nearly 3 in 4 companies beat expectations.

Moving forward, the two chief culprits behind falling profits are expected to recede. The strengthening of the U.S. dollar against world currencies that took place in 2015 has reversed this year, giving relief to manufacturers and global retailers who saw export demand decline.

Companies including Amazon, Procter & Gamble and Pfizer have cited softening foreign exchange pressures as reasons for higher earnings going forward. “It’s basically now built into the earnings,” Jeff Carbone, founding and managing partner of Cornerstone Financial Partners, said.

Commodity prices have recovered somewhat, with crude oil prices picking up more than 40 percent since mid-February, giving hope to drillers and refiners that the end of the long energy slump is in sight.

That recovery wasn’t enough to stem losses in the energy sector during the first quarter, however, which recorded an overall decline of 80 cents per share, pulling total Standard & Poor’s 500 earnings down 3 percent. In all, 7 in 10 sectors of the S&P 500 saw earnings fall in the first three months of 2016, with the financial and technology sectors posting particularly steep drops.

But the pace of declines has slowed recently on a quarter-to-quarter basis, with the first quarter declining 5.9 percent, compared to a plunge of 13.8 percent at the end of 2015. Consensus estimates see companies recording a second-quarter drop of just 2 percent, before rising toward the end of the year.

Companies themselves are optimistic, too. Around one-third of companies have projected profit gains above those expected by analysts, the strongest bout of corporate optimism seen since December 2010, according to Goldman. By the end of the year, corporate America expects to see earnings growth of 7.5 percent, according to FactSet.

The biggest driver should be domestic demand, Chadha said, citing a recovery in manufacturing sector inventory and delivery demand. As the U.S. dollar continues to fall against major currencies, earnings could see a boost of nearly 2 percent, Chadha said.

But risks to corporate profit margins remain. In particular, rising wages threaten to keep earnings growth on hold. The historically tepid rate of wage gains have helped push corporate profit margins to record levels in recent years. But labor market indicators are now flashing positive for workers.

More workers are quitting their jobs, for instance, a sign of confidence in finding a raise at the next employer. States and cities, meanwhile, have boosted minimum wages, affecting retailers like Walmart and fast-food chains like McDonald’s. It’s good news for the American worker, but a potential drag on earnings — just as corporations try to put their sharpest profit contraction in years behind them.

But Carbone cautioned against reading too much into these trends. “Even though wage growth has improved, it’s only recently improving. It hasn’t been a continued steady climb,” he said. “It’s going to happen, but we may have a little time before that has a major impact on earnings.”