Stocks waded further into the green on Wednesday afternoon after former FBI director James Comey's prepared testimony for Thursday was made public. Wall Street had been under pressure earlier after a major selloff in crude oil prices on Wednesday bled into the energy sector.

Stocks returned to the green by mid-afternoon Wednesday. The S&P 500 was up 0.14%, the Dow Jones Industrial Average gained 0.2%, and the Nasdaq rose 0.26%.

Comey detailed his numerous meetings with President Trump since January in his opening statement for his Thursday appearance before the Senate Select Committee on Intelligence. Comey said he had not told Trump that he would cease investigations into former National Security Adviser Michael Flynn despite Trump's request. Comey also said that Trump had said, "I need loyalty. I expect loyalty." Comey based his testimony on his recollections and a series of memos composed after several meetings. 

Following this opening statement on Thursday, Comey will answer questions from the Senate Intelligence Committee. 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.

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.

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.9% to $45.86 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) , Chevron (CVX) , BP (BP) , ConocoPhillips (COP)  and Occidental Petroleum (OXY) sported major losses, while the Energy Select Sector SPDR ETF (XLE) declined 1.8%. 

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. 

"There are a few certainties in this election, but one thing we almost know for sure is that turbulence in financial markets is likely to intensify in the short-term as Britain readjusts," Tom Elliott, deVere Group's international investment strategist, wrote in a note.

The European Central Bank on Thursday 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.

Dave & Buster's (PLAY)  rose after 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) fell 10% 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) , Dollarama ( DOL)  and Brown-Foreman ( BF.A) .

Novavax (NVAX) increased 9% 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) moved 1% 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. 

Read More Trending Articles:

More from Futures

Stock Futures Edge Lower Amid Disappointing Tech Guidance

Stock Futures Edge Lower Amid Disappointing Tech Guidance

Facebook's Revenue Miss and 4 Other Stories to Watch Thursday

Facebook's Revenue Miss and 4 Other Stories to Watch Thursday

Facebook Earnings and 4 Other Stories to Watch Wednesday

Facebook Earnings and 4 Other Stories to Watch Wednesday

Alphabet Eyes a Record High and 4 Other Stories to Watch Tuesday Morning

Alphabet Eyes a Record High and 4 Other Stories to Watch Tuesday Morning

Tesla Seeks Price Reductions and 4 Other Stories to Watch Premarket Monday

Tesla Seeks Price Reductions and 4 Other Stories to Watch Premarket Monday