Stocks didn't know whether to go up or down on Thursday.

It was an unsettled session in which stocks rallied then tumbled then coasted to close out near session highs. The S&P 500 was up 0.54%, the Dow Jones Industrial Average climbed 0.78%, and the Nasdaq increased 0.86%.

Uncertain trading is symptomatic of how Wall Street has fared so far this week -- a lot of noise while essentially treading water. Since Monday, the Dow has moved in a 340-point range but only fallen 0.2%. 

Volatility could continue as uncertainty remains one of the most prominent unifying threads for global markets. 

"The market doesn't know where and what direction it's headed," Robert Pavlik, chief market strategist at Boston Private Wealth, told TheStreet. All these factors -- China, Europe, the U.S. economic activity, oil, the Federal Reserve and earnings -- have all contributed to the volatility that we've been seeing and of course with the advent of ETFs and internet trading, it makes it that much more susceptible to volatility."

A rally in energy stocks offset a selloff in the health care sector on Thursday. Crude oil jumped on reports Russian Energy Minister Alexander Novak spoke with Saudi Arabian officials to cut production by up to 5% in light of weaker prices. West Texas Intermediate crude oil jumped 2.9% to $33.22 a barrel.

Commodity traders reacted positively to the reports, but any deal has yet to be confirmed. Some remain skeptical the two countries can come to an agreement. 

"While the potential for a significant bullish stimulus exists in this situation, diplomatic and strategic obstacles -- notably Russia and Saudi Arabia's differing views on the Syrian government and the latter's obstinate dedication to the defense of market share -- will prove major hindrances to cooperation," T. Austin Sapp, commodity analyst at Schneider Electric, wrote in a note.

The energy sector was the best performer as large-cap oilers including Exxon Mobil (XOM) , Chevron (CVX) , Schlumberger (SLB) , and ConocoPhillips (COP) jumped. The Energy Select Sector SPDR ETF (XLE) rose 3%.

A number of disappointing earnings reports and softer-than-expected guidance from health care stocks including Celgene (CELG) dragged on the broader sector. Health care was the worst performer on markets Thursday with major drugmakers Pfizer (PFE) , Merck (MRK) , Gilead Sciences (GILD) and Bristol-Myers Squibb (BMY) lower. The Health Care SPDR ETF (XLV) tumbled 2.3%.

Facebook  (FB) led the Nasdaq higher, jumping 15% after reaching $1 billion in quarterly profit for the first time. The social network beat analysts' estimates on its top- and bottom-lines with results driven by increased advertising demand.

Facebook is a holding in Jim Cramer's Action Alerts PLUS charitable trust portfolio.

You see Jim Cramer on TV. Now, see where he invests his money and why Facebook is a core holding of his multi-million dollar portfolio.

Want to be alerted before Jim Cramer buys or sells FB? Learn more now.

Xerox (XRX) fell 1% after the bell following reports the company plans to separate its hardware and services businesses into two entities. Activist investor Carl Icahn will reportedly also get three seats on the services company's board, according to The Wall Street Journal. Icahn holds a stake of more than 8% in the printer company. 

If you liked this article you might like

How to Invest in Oil

How to Invest in Oil

Jim Cramer: These 4 Stocks Seem Attractive Right Here

Jim Cramer: These 4 Stocks Seem Attractive Right Here

Occidental, RSP Permian Pumping More Shale Oil Than Expected, Goldman Says

Occidental, RSP Permian Pumping More Shale Oil Than Expected, Goldman Says

How I'm Playing Infrastructure, Oil and Defense Stocks Right Now

How I'm Playing Infrastructure, Oil and Defense Stocks Right Now

Volatility Is Still in Charge: Cramer's 'Mad Money' Recap (Friday, 2/9/18)

Volatility Is Still in Charge: Cramer's 'Mad Money' Recap (Friday, 2/9/18)