SHANGHAI - China's yuan gave up all of its gains on Wednesday to end weaker for a 10th session, despite the central bank setting a firmer-than-expected midpoint to help stabilise the currency.

Investors widely took the guidance rate, set higher than market expectations for a second day, as a sign the People's Bank of China was attempting to slow the pace of depreciation.

Onshore spot yuan wrapped up the domestic session at 7.1635 per dollar as of 0830 GMT, 10 pips weaker than the previous late session close of 7.1625.

If the onshore spot yuan finishes the late night session at the domestic closing level, it would mark the longest losing streak since December 2015.

The currency has lost 3.7% against the greenback since a major escalation in the Sino-U.S. trade war in early August, following U.S. President Donald Trump's threats to slap more tariffs on Chinese goods.

The renminbi is set for its biggest monthly drop since China unified official and market exchange rates in 1994.

Prior to market opening on Wednesday, the PBOC lowered its official yuan midpoint CNY=PBOC to 7.0835 per dollar, 25 pips weaker than the previous fix of 7.0810 and the weakest since March 18, 2008.

Although the fixing was a fresh 11-1/2-year low, traders said the guidance was much stronger than their forecasts, a situation that was also witnessed on Tuesday.

"It's clear that the PBOC is beefing up the counter-cyclical measure to avoid at all cost any negative fallout from the U.S. Treasury that they are attempting to weaponise the yuan as a tariff offset, which is suggesting that Beijing would like to de-escalate trade tensions with Washington," Stephen Innes, managing partner at Valour Markets, said in a note.

Wednesday's official guidance rate was 192 pips or 0.27% stronger than Reuters' estimate of 7.1027 per dollar.

Several traders said the PBOC's heavy use of its counter-cyclical factor to keep the midpoint above 7.1 per dollar was similar to a trend from late May through mid-June, when the central bank persistently kept the fixing above 6.9 per dollar level to rein in depreciation pressure.

During that period, spot yuan was capped in a very tight range above 7 per dollar - a previously key level for the market. Spot yuan breached that mark on Aug. 5.

Market participants believe the counter-cyclical factor, a tool first introduced to the midpoint fixing formula in May 2017, was not meant to reverse the course of the yuan's movements but to reduce price swings.

"It could mean the current yuan prices are very close to the authorities' bottom line for now," said a trader at a foreign bank.

The huge deviation between market forecasts and the official fixing is too large not to be interpreted as being part of the authorities' stance on where the rate should be, he said.

A second trader at a Chinese bank said many market participants now see 7.2 as the floor for the spot yuan.

Iris Pang, Greater China economist at ING in Hong Kong, outlined two points of action for China - it may release its unreliable entities list and hold a firm stance on trade talks with the United States.

"Both measures will end up with a weaker yuan, as such, we revise our USD/CNY forecasts," she said in a note, joining several other international investment banks who have revised down year-end yuan forecasts this week.

The yuan is expected to finish the year at 7.2 per dollar, 7.3 at the end of 2020 and 7.2 for end-2021, versus previous forecasts of 7.1, 7.0 and 6.9, respectively, Pang said.

China's commerce ministry has said it would consider putting firms on an unreliable entities list if they implement discriminatory measures, hurt Chinese industries or threaten national security. 

The offshore yuan CNH=D3 was trading at 7.1704 per dollar as of 0830 GMT.

(Reporting by Winni Zhou and John Ruwitch; Editing by Jacqueline Wong) ((winni.zhou@thomsonreuters.com; +86 21 2083 0100; Reuters Messaging: winni.zhou.thomsonreuters.com@reuters.net))