Oil staged a recovery on Friday after a whipsaw week that saw the shares of oil and energy companies plunge and then recover on expectations that the Organization of Petroleum Exporting Countries, or OPEC, and its allies will soon cut output, helping boost profit expectations of energy companies.

WTI crude was up 45 cents at $56.90 a barrel as of 3 p.m. ET, though still on track to end lower for the sixth consecutive week. The S&P 500 energy index was up 1% mid-afternoon.

Exxon Mobil (XOM) jumped 77 cents to $78.98, a 1.07% gain on the day. It began the week at just over $81 a share. British Petroleum (BP) dropped more than 35 cents at mid-afternoon to $40.81, a near-1% loss, having started the week at $41.60. Chevron Corp. (CVX)  was up 1.75% mid-afternoon to $118.01. Down for Monday's high of $120.18.

"It's been a heck of a month," says Eric Nuttall, Partner and Senior Portfolio Manager with Toronto-based Ninepoint Partners, which oversees more than $3 billion in assets. "We've had added volume that was supposed to offset the losses coming from Iran as a result of trade sanctions."

Despite threats to cut Iran's oil exports to zero, U.S. President Donald Trump last week granted waivers allowing eight countries to continue to import Iranian oil. Russia, Saudi Arabia and others had previously increased their output in advance of the proposed sanctions on Iran, only to find themselves oversupplied when the waivers were granted.

"This supply overhang was reinforced by yet another huge build on U.S. API inventories, of 8.79m barrels, well above expectations of 3.2m," noted CMC Markets Chief Analyst Michael Hewson. "This is the biggest build since February, and puts oil prices on course to record their sixth successive weekly decline."

OPEC and other non-OPEC oil producers will meet in early December, where it is largely expected they will cut production.

More from Markets

What Fools We All Have Become, and Buying Lam Research: Market Recon

What Fools We All Have Become, and Buying Lam Research: Market Recon

Ford, Intel, Starbucks, Texas Instruments and Microsoft - 5 Things You Must Know

Ford, Intel, Starbucks, Texas Instruments and Microsoft - 5 Things You Must Know

How Rate Changes Could Affect Consumers in 2019

How Rate Changes Could Affect Consumers in 2019

Bears Are Growling About Slowing Growth, but the Market Is Resisting

Bears Are Growling About Slowing Growth, but the Market Is Resisting

Jim Cramer: 7 Trends That Can Guide Us Through This Turmoil

Jim Cramer: 7 Trends That Can Guide Us Through This Turmoil