In the three-year-long drama that is the oil market, there was some good news this week, with signs that both U.S. shale producers and OPEC may be exercising some discipline.

The U.S. oil rig count dropped two of the past four weeks, Anadarko Petroleum announced in its earnings report that it is cutting back on spending for the rest of 2017, and oil services company Halliburton said for the second time in recent weeks that its customers were tapping the brakes.

As well, after meeting in St. Petersburg, Russia on Monday, Saudi Arabia said that it would limit its exports to the United States while Nigeria agreed to cap its production at 1.8 million barrels per day.

As a result, the price of oil traded above $48 US a barrel, a welcome uptick from the low 40s it had settled into earlier in the month.

Shale oil producers flexible

"We know U.S. shale can turn off and on pretty quickly," said Robert Mark, an energy analyst with Raymond James. "A five-, six- or seven-dollar swing on oil is enough for the economics on some of these shale plays to shift from go to not-go."

American Petroleum Institute numbers released late Tuesday showed a 10 million barrel reduction in U.S. inventories in the week ended July 21, about four times as much as analysts had expected.

Halliburton began warning two weeks ago that the shale boom was running into some trouble. The company's head of business development said he expects the U.S. rig count to hit 1,000 at the end of the year, but then top out as demand for services causes costs to go higher. As of last week, 950 rigs were at work in the U.S.

As Mark said, the profit margin on shale oil is tight, with costs in some parts of the U.S., like Texas's Permian Basin, lower than other parts of the country. About half of the operating rigs in the U.S. last week were in Texas.

"The A-type prospects are going to drill in the 40s, like in the Permian," he said. "And the next question — where do those B-type prospects come into play? My guess, from anecdotal evidence, is that's probably in the high 40s, low 50s."

Saudi works to bring down U.S. inventories

That puts a top on the price of oil in the near term, stuck between the low 40s where even Texas shale oil becomes uneconomic and the low 50s where other shale plays become an option. That will remain the case until we start to see less oil being held in storage in the United States.

That is what Saudi Arabia is working on right now. It knows that the weekly report from the U.S. Energy Information Administration (EIA) is under laser-like focus by producers, analysts and traders alike; and Saudi Arabia has already started pulling back on the oil it exports to the United States.

It said this week that it would cap exports at 6.6 million barrels per day, much lower than it was shipping a year ago. That doesn't necessarily mean that it will ship that oil to other parts of the world, such as Asia but it should have an impact on U.S. numbers. Until those inventories draw down, it's going to be hard to see oil break much above $50 US.

But Mark says that should eventually happen and then oil producers can have a harder look at future growth.

"As it stands right now the world is in slight deficit in terms of supply and demand," he said. "If you get those inventories down, then you have a more normalized industry and then you can look at the big picture."