Stocks moved cautiously higher on Wednesday as investors waited for direction from a number of market-churning events on Thursday and a major selloff in crude kneecapped indexes. 

The S&P 500 was up 0.11%, the Dow Jones Industrial Average gained 0.06%, and the Nasdaq rose 0.2%. 

Losses in crude oil prices picked up speed on Wednesday after a surprise increase in domestic crude stockpiles. Inventories rose by 3.3 million barrels in the past week, the Energy Information Administration said, surprising analysts looking for a decrease of 3.5 million barrels. Gasoline and distillates stockpiles both increased.

Adding to risks, on Tuesday the EIA reduced its price forecast for oil next year. The energy watchdog now anticipates West Texas Intermediate to average $53.61 a barrel over 2018, 2.7% than its former target, though 2017 price forecasts were increased by 0.2% to $50.78. The EIA also nudged its 2018 U.S. production targets higher.

Commodities have been under pressure this week after Saudi Arabia led a group of allies to cut diplomatic ties with Qatar for its alleged association with terrorism. The effect on a recently extended production cut agreement among Organization of Petroleum Exporting Countries is not yet known.

West Texas Intermediate crude was down 4.3% to $46.11 a barrel on Wednesday.

You can't expect a real panic to liquidation to begin until oil reaches $43 a barrel, Cramer argued on Real Money. Get his insights with a free trial subscription to Real Money.

The energy sector was the worst performer on markets Wednesday. Major oil companies Exxon Mobil (XOM - Get Report) , Chevron (CVX - Get Report) , BP (BP - Get Report) , ConocoPhillips (COP - Get Report)  and Occidental Petroleum (OXY - Get Report) sported major losses, while the Energy Select Sector SPDR ETF (XLE - Get Report) declined 1.4%. 

The investigation into the Trump campaign's alleged ties with Russia will come back into the spotlight as former FBI director James Comey delivers public testimony on Thursday. Comey, speaking to the Senate Intelligence Committee, will likely touch upon whether President Donald Trump acted improperly in inserting himself into an ongoing investigation. 

Trump fired Comey in May while the FBI was investigating the Trump transition team's ties to Russia. News reports indicated that Trump had asked Comey for his loyalty and requested he stop investigating former National Security Adviser Michael Flynn.

Also on Thursday, U.K. citizens will head to the polls as the country continues to mourn terrorist attacks in Manchester and London in the past few weeks. Prime Minister Theresa May holds the lead in the polls over Labor's Jeremy Corbyn. In the wake of the London attack over the weekend, May has hardened her position against extremism, arguing that she would alter human rights laws if needed to protect the British people. The election results will likely not be fully tabulated until Friday morning in London. 

Also on Thursday, the European Central Bank will announce a decision on monetary policy. Improving economic data in the eurozone could affect members' growth forecasts for 2017 and 2018.

The wait for clarity on these events has left markets with little reason to push equities further into record territory. Stocks have fallen for the past two days after notching new records late last week. 

There are buying opportunities ahead of this "triathlon of fear," Jim Cramer argued over on our premium site for investors, Real MoneyGet his insights with a free trial subscription to Real Money.

Early Wednesday, Trump nominated former Justice Department official Christopher Wray as the next FBI director. Trump called Wray a "man of impeccable credentials" in his Twitter announcement. Wray previously served as assistant attorney general under President George W. Bush.

Dave & Buster's (PLAY - Get Report)  rose despite a better-than-expected quarter. The gaming restaurant chain earned an adjusted 87 cents a share, 6 cents above consensus. Revenue of $301.1 million came in $1 million higher than expected. 

Ambarella (AMBA - Get Report) fell after issuing a disappointing forecast. The camera parts maker estimates current-quarter sales of $69 million to $72 million, below consensus of $72.3 million. Its gross margin is expected to fall to 62% to 63.5% from the first-quarter's 64.3%. 

Other earnings of note include Analogic ( ALOG) ,  Sigma Designs ( SIGM) , United Natural Foods ( UNFI - Get Report) , Dollarama ( DOL - Get Report)  and Brown-Foreman ( BF.A - Get Report) .

Novavax (NVAX - Get Report) increased 6% following positive results from a vaccine trial. The mid-stage clinical trial was for a maternal vaccination to prevent babies from suffering severe lower respiratory tract infections. "The Western Blot data suggest the potential to protect both the pregnant mothers and their infants from RSV disease," said President of research and development Dr. Gregory Glenn.

European stocks traded mixed on Wednesday after Spain's Banco Santander  (SAN) acquired struggling Spanish lender Banco Popular (BPESY)  for €1 in a move orchestrated by the ECB.

United Continental (UAL - Get Report) moved lower after reporting a decline in its load factor during May. Load factor in May fell to 81.6% from 82.5% the same month last year. Traffic increased by 2.6%. The airline also said "involuntary denied boardings" had dropped by 79% since last year. The airline has made efforts to increase passenger incentives to give up seats on overbooked flights after the controversy surrounding dragging one of its passengers off a flight in April.