Traders work during the opening bell at the New York Stock Exchange (NYSE) on Oct. 2, 2019 at Wall Street in New York City.

As corporate earnings reports roll in, analysts are keeping a close eye on profit margins as a possible early warning signal for the markets and economy.

Profit margins are showing some signs of contraction, but Ned Davis Research analysts say there's no broad deterioration yet, and they expect margins to be flattish. But the analysts do note that "stagnating margins are an obstacle in the way of accelerating earnings growth, something likely needed for a year-end rally."

Net profit margins for the third quarter are currently predicted to be 11.3% for the S&P 500, below the 11.5% of the second quarter but better than the first quarter's 11%, according to FactSet.

"If 11.3% is the actual net profit margin for the quarter, it will mark the first time the index has reported three straight quarters of year-over-year declines in net profit margin since Q1 2009 through Q3 2009," FactSet analysts said in a note. Nine of the 11 sectors are reporting a year-over-year decline in their net profit margins for Q3 2019, led by energy, at 5.4% versus 8.1%, and information technology, at 20.6% from 23%.

"If we are on the path to a recession, we would expect operating margins to start dropping quickly, followed by a quick turn up in the unemployment rate a few quarters later. That we have seen neither of those adds conviction to [our] base case of no recession next year," the Ned Davis analysts wrote. They said financials and banks are their main margin concern currently, but a Fed easing cycle could alleviate margin pressure.

They add that margins typically peak 17 months before a recession, on average. "We have also noticed that operating margins peak an average of seven months prior to troughs in the unemployment rate. The unemployment rate troughs, on average, about 10 months prior to a recession," they wrote.

The unemployment rate fell to 3.5% in September, its lowest rate since 1969.

"We take margin deterioration seriously because it can be a precursor to layoffs and a recession. In the late stage of an expansion, companies often cut labor expense in order to preserve earnings growth. While layoffs may temporarily save growth, it can start a negative feedback loop that leads to recession," noted the Ned Davis analysts.

Credit Suisse analysts have also been watching margins, and they see the biggest declines coming for energy companies and some tech and communications firms, like Alphabet, Amazon, Apple and Facebook, which have yet to report. Credit Suisse said the consensus decline in Amazon margins, for instance, is expected to be 42.5%, and that could dent the S&P 500 overall earnings growth by 0.3%.

"If I look at 2020, we're going to have a growth rate that is being driven primarily by revenues and revenue buybacks, and we're going to to have margins that are roughly flat. Certainly some groups may be negative versus certain groups that may be positive," said Patrick Palfrey, senior equity analyst at Credit Suisse.

Palfrey said the trade war, regulatory costs for social media companies and the weakness in oil prices from a sluggish global economy are all contributing to margin pressures. "The reason we are experiencing negative margins this year is unique to the events that are taking place in energy, around falling oil and technology," he said.

According to FactSet data, margins for the S&P 500 reached a high of 12% in the third quarter of 2018, before falling to 11.2% and staying roughly flat since then.

The Ned Davis analysts said it's a positive that S&P 500 operating margins are flat. They define operating margins as income before depreciation and amortization / sales for the S&P 500. They say there was a peak in operating margins as being in the first quarter, and the level is now down only 9 basis points.

"The bad news is, we have already started to see some margin deterioration in the two largest sectors, Technology (-40 bps) and Financials (-80 bps). These margin declines have been partially offset by margin improvement for Industrials (+30 bps) and Health Care (+30 bps), but bear watching. If S&P 500 operating margins fell over 40 bps from their peak, we would start to get nervous," the Ned Davis analysts noted.