To start 2018, many on Wall Street were predicting a great year for stocks, as Donald Trump's tax plan was expected to produce elevated mergers and acquisitions activity. 

The deal activity has certainly been a part of the 2018 story, but the trend could slow down in 2019, said analysts from Goldman Sachs.

Deal announcements are expected to increase 20% year over year in 2018, according to a note from Goldman that was released Tuesday. "But there is less certainty around the outlook for dealmaking in 2019," the analysts said. 

Deals, of course, can't take place all the time, and the number of publicly traded companies can't shrink forever. U.S. stocks, which performed well through September, have sold off and the economic outlook for 2019 has turned significantly less rosy against 2018. "Note that November data does not capture the recent market selloff (SPX down 4% MTD), suggesting a modestly weaker M&A environment as we head into the end of the year," Goldman said. 

The M&A activity in 2018 has been led by the healthcare sector. "Healthcare has been the best performing sector YTD in terms of deal count, up 30%," Goldman said. There have been 255 healthcare deal announcements in the second quarter of 2018, according to PricewaterhouseCoopers. And some of those deals were sizable. 

CIGNA Corp.  (CI) - Get Report will buy Express Scripts Holding Co. (ESRX) for $67 billion, which the companies announced in March, and CVS Health Corp. (CVS) - Get Report announced in February it was purchasing Aetna Inc. (AET) for $69 billion, which the Department of Justice just approved. 

In addition, UnitedHealth Group Inc.'s (UNH) - Get Report Optum reached an agreement to buy DaVita Inc. (DVA) - Get Report for $4.9 billion. 

The S&P Healthcare Services Select Index has risen 15.72% year to date. 

In the media sector, Walt Disney Co. (DIS) - Get Report  reached a deal to buy certain assets of Twenty-First Century Fox Inc. (FOXA) - Get Report  for $71.3 billion, which is one of the largest deals of the year. 

A major headwind to M&A activity in 2019 could be a slowing economy as companies will be less willing to commit huge amounts of capital for new businesses. Morgan Stanley economists said there was now a 15% chance of a recession in 2019, and a 30% chance for 2020. 

CVS, UnitedHealth and Disney are holdings in Jim Cramer's Action Alerts PLUS member club. Want to be alerted before Jim Cramer buys or sells the stocks? Learn more now.