Wall Street analysts’ forecasts have a habit of tending toward optimism. Considering what is going on with oil and the dollar, right now they are tending toward the ridiculous.

Companies are in the midst of reporting fourth-quarter numbers, and so far the news has been less than good. As of Friday, with results from 90 companies in, estimates called for S&P 500 earnings to be up just 3.5% from a year earlier, according to Thomson Reuters. This was a shade below the 4% analysts were looking for at the start of the year. Typically, the earnings-growth estimate drifts up as results come in and companies clear the bars analysts have set for them.

The sharp decline in oil prices is a big reason overall earnings growth is so weak. Absent an estimated 24% decline in energy-sector profits, S&P 500 earnings would be on track for an increase of about 7%. Meanwhile, the strong dollar also is cutting into the money U.S. companies are drawing from their overseas operations. On Friday, Kimberly-Clark said foreign-exchange weakness clipped its fourth-quarter sales by 4%; McDonald’s said a quarter of its 20% decline in net income was due to currency effects.

The effects of oil and the dollar look as if they will only intensify in the quarters to come. Crude oil now is fetching about $ 45 a barrel, which compares with an average daily price of $ 73.20 in the fourth quarter. The ICE U.S. Dollar Index shows the dollar is now 8% stronger against other major currencies relative to its average level in the fourth quarter. Moreover, the effects of dollar strength on profits come with a lag. That is partly because some companies hedge against currency swings and partly because many globally traded goods are priced in dollars.

© Provided by The Wall Street Journal.

Yet analysts are remarkably upbeat on where earnings are headed. For the full year, they expect S&P 500 earnings will increase roughly 6%, not far off 2014’s gain of about 7%. Much of this growth is supposed to occur during the latter part of the year. In the fourth quarter of 2015, analysts estimate S&P 500 earnings will be about 11% above their year-earlier level.

A look across estimates for different sectors shows how difficult that level of growth will be to achieve.

First, energy-sector earnings in the fourth quarter of this year are expected to show an 18% decline from a year earlier. That seems large, but it looks to be based on overoptimistic assumptions on where oil is heading. Looking only at Wall Street firms that this month have updated the forecasts they submit to FactSet, the average estimate for the price of crude oil in the fourth quarter is $ 64.56 a barrel, 42% above Friday’s level.

Consumer-staples companies—ones like Coca-Cola and Colgate-Palmolive that sell everyday consumer goods—are expected to show earnings growth of 8.8% in the fourth quarter of 2015, versus 0.2% last quarter. This is despite their hefty exposures to foreign currencies. The technology and industrials sectors, which also do a great deal of business overseas, also are expected to show strong growth. As is the materials sector, which includes many companies that are exposed to weakening commodity prices.

The major beneficiaries of lower oil prices and the rising dollar are U.S. consumers. They will be able to use the money they save on gas and imported goods to buy more elsewhere. But the consumer-discretionary sector—made up of companies such as retailers that most directly benefit from stepped-up consumer spending—accounts for only about a 10th of total S&P 500 earnings. What’s more, analysts forecast profits for the sector will increase at a double-digit-percentage rate through this year, with fourth-quarter 2015 earnings 18% higher than a year earlier.

Eventually, analysts will need to temper their enthusiasm. But investors may not have the luxury of waiting for reality to sink in.

Write to Justin Lahart at justin.lahart@wsj.com