

The offshore Renminbi (CNH) exchange rate against the United States dollar (USD) better reflects the immediate changes in market supply and demand and investor sentiment due to its exemption from foreign exchange control in mainland China. This paper explores how to improve the forecasting accuracy of the offshore RMBUSD exchange rate by constructing an investor sentiment index based on online forums and news comments. This paper firstly collects and analyzes many financial news headlines on the English for Treasury website, and applies the BERT model in natural language processing technology to identify and quantify the sentiment tendencies in the news headlines, to construct a daily investor sentiment index. Subsequently, this sentiment index is combined with traditional financial market and macroeconomic indicators, and a variety of advanced machine learning and deep learning methods, including Random Forest, Support Vector Machines, Long Short-Term Memory Networks (LSTM), and Gated Recurrent Units (GRUs), are applied to forecast the offshore RMB exchange rate. It is found that the introduction of sentiment indices significantly improves the accuracy of the prediction models. Especially in LSTM and GRU models, the inclusion of sentiment index makes the models perform better in capturing the nonlinear features of exchange rate fluctuations.