LONDON (Reuters) - Oil prices flirted with both positive and negative territory on Tuesday, hovering around $50 a barrel on tentative signs that a persistent rise in U.S. crude production may be slowing.

An oil well pump jack is seen at an oil field supply yard near Denver, Colorado, U.S., February 2, 2015. REUTERS/Rick Wilking/File Photo

The international benchmark LCOc1 settled down 7 cents at $49.61 per barrel. U.S. West Texas Intermediate (WTI) crude futures CLc1 were trading up 1 cent at $47.08 a barrel.

Both contracts traded lower earlier in the session as many traders closed positions ahead of the U.S. Independence Day holiday on July 4, while Brent also faced technical resistance as it approached $50, traders said.

Despite this, the market’s outlook has shifted somewhat.

Late May and most of June were overwhelmingly bearish as U.S. output rose and doubts grew over the ability of the Organization of the Petroleum Exporting Countries to hold back enough production to tighten the market.

But sentiment began to shift toward the end of June, when data showed a dip in U.S. oil output and a slight fall in drilling for new production. RIG-OL-USA-BHIC-OUT-T-EIA

“The fact that prices have not come under any noticeable pressure of late points to a shift in sentiment,” Commerzbank said on Tuesday.

“This may be related to the fact that most of the ‘shaky hands’ have withdrawn from the market by now,” the bank added.

Prices rose in recent days despite OPEC production hitting a 2017 high of 32.72 million barrels per day (bpd) in June, according to a Reuters survey.

The group’s efforts to rebalance the market have been undermined by rising production from Libya and Nigeria, which are exempt from an output-cutting agreement.

Libya is pumping around 1 million bpd of crude, a four-year high.

OPEC exports rose for a second month in a row in June to 25.92 million bpd, up 1.9 million bpd from the same month last year, according to Thomson Reuters Oil Research.

“We see a recovery for oil prices in H2 2017 from current levels, with OPEC production cuts, a slowdown in global supply growth and seasonally firming demand driving up prices,” BMI Research said, although it added that “large-volume supply additions will keep price growth flat year on year in 2018”.