# Stock Forecasting Model FS-LSTM Based on the 5G Internet of Things

Authors: Hui Li; Jinjin Hua; Jinqiu Li; Geng Li
Journal: Wireless Communications and Mobile Computing
 (2020)

---

## Abstract

This paper analyzed the development of data mining and the development of the fifth generation (5G) for the Internet of Things (IoT) and uses a deep learning method for stock forecasting. In order to solve the problems such as low accuracy and training complexity caused by complicated data in stock model forecasting, we proposed a forecasting method based on the feature selection (FS) and Long Short-Term Memory (LSTM) algorithm to predict the closing price of stock. Considering its future potential application, this paper takes 4 stock data from the Shenzhen Component Index as an example and constructs the feature set for prediction based on 17 technical indexes which are commonly used in stock market. The optimal feature set is decided via FS to reduce the dimension of data and the training complexity. The LSTM algorithm is used to forecast closing price of stock. The empirical results show that compared with the LSTM model, the FS-LSTM combination model improves the accuracy of prediction and reduces the error between the real value and the forecast value in stock price prediction.


---

## Body

## 1. Introduction

The wide application of information technology gives rise to the increase in data flow and the number of intelligent terminals. As a result, the fifth-generation (5G) mobile services come into being. According to global telecom operators, 5G communication technology will be officially commercialized around 2020 [1]. Owing to the fast transmission network, the emergence of the 5G network will promote the innovation and development of the Internet of Things (IoT) technology. The 5G network is identified as a core contributing factor in meeting the growing needs for the future IoT services, including high data rate, multiple-device attachment, and low delay service [2]. As 5G mobile communication network technology can provide users with sufficient network communication, it can greatly improve the network communication speed and quality, making the network data transmission changes more reliable.With its great adaptability, IoT technology can be applied to different scenarios, such as construction domain [3], smart cities environments [4], smart communities [5], and other areas of society, bringing much convenience for people. The utility of IoT technology requires massive information connection and high-speed network communication. The emergence of the 5G network can promote the innovation and development of IoT technology. 5G has the advantages of fast data convey rate, strong robustness, wide transmission range, and good security [6]. Thus, the application of 5G wireless systems can effectively improve the communication quality of the IoT, making the IoT technology more powerful. 5G is the basic access technology for IoT utilization [7]. What is more, the use of 5G communication network infrastructure can also reduce the cost of IoT construction and investment, consequently improving the efficiency of IoT construction. The integration of the 5G mobile communication network and IoT enables the IoT to make full use of the advantages of the 5G mobile communication network and enhance its own advantages.With the increasing exploitation of the IoT, the advantages of big data technology have gradually become prominent. Big data involves many key technologies, including collection, storage, management, analysis, and mining. Big data usually relate to the use of predictive analytics, patral behavior research, or some other sophisticated data analysis tool, which can extract the valuable information from the massive data. 5G networks deal with big data at low cost. Besides, characteristics of 5G include low latency, high reliability, easy-to-update data, region spread, and improved mobile broadband [8]. The era of big data has aroused widespread interest in in-depth learning in different research fields. The deep integration with AI, cloud computing, big data, and deep learning is one of the important development directions of 5G.Our contributions in this paper can be highlighted as follows:(1)
The development trend of 5G, IoT, and data mining and the influence of deep learning on data mining technology of IoT are analyzed(2)
A stock trend prediction method based on the feature selection (FS) and Long Short-Term Memory (LSTM) prediction model FS-LSTM to predict stock prices are put forth. First, we use the Tushare financial data package to obtain stock data. Then, the optimal feature set is selected to reduce the dimensionality of data. After that, the stock price is forecasted and the forecasting results are analyzed(3)
The application of 5G and IoT in stock forecasting is analyzed in aspects of data storage, efficiency, and processing speedThis paper falls into 6 parts. Section2 describes some basic relevant algorithms related to the proposed idea. In Section 3, we illustrated in detail the design and implementation of the proposed prediction algorithm. The application of 5G and IoT in stock forecasting is analyzed in Section 4. Section 5 discusses the experimental results of our proposed FS-LSTM. Section 6 is the summary of the whole paper.


## 2. Related Work

### 2.1. The Integration Development of 5G, IoT, and Deep Learning

5G is aimed at providing super ultralow delay technological schemes as well as fiber-like access data transmission speed, to connect over 100 billion facilities and deliver accordant experience across multiplex scenarios with improved capability and spend efficiency [9]. 5G mobile communication technology improves customer experience and system safety of communication technology, so it has been widely used in all walks of life [10]. A 5G-enabled IoT is devised to convey both 5G and IoT information and at the same time to reduce the whole IoT power consumption while maintaining 5G and IoT transmission rates steady [11]. 5G-enabled emotion-aware linked healthcare big data was designed. The proposed method will greatly promote 5G-based individualized and corresponding emotion-aware medical services [12]. With the development and popularization of 5G technology and IoT, new data mining algorithms were boosted [13]. Big data, IoT, and 5G are closely related to each other, for big data stems from the application of IoT technology.5G will prove to be the mainstay of IoT, providing full links to all “things,” surmounting place restrictions on time-space, and bringing about comprehensive, service-customized, and user-centric interconnections [14]. The relationship between 5G, IoT, and deep learning is shown in Figure 1. As shown in Figure 1, the entire system of the IoT constitutes three layers, namely, the perceptual layer, the transport layer, and the application layer. 5G communication provides technical support for network layer transmission. In the big data era, not all massive data are valuable. What is more important is to mine useful data via the deep learning algorithm. Among them, large data analysis methods based on deep learning have been developed more rapidly.Figure 1
The relationship between 5G, IoT, and deep learning.The development of 5G communication technology and IoT enables the application of the neural network and deep learning. IoT is extensively used in various fields, such as intelligent logistics, smart healthcare, pilotless driving, industrial automation, and global positioning system (GPS) data aggregation [15]. Based on 5G communication agreements and data interchange criterion, with the convergence of the IoT and artificial intelligence (AI), the smart network performs much better communicating ability. To build an efficient intrusion detection system over big data, literature [16] proposed a classification algorithm based on data clustering and data reduction. IoT, as an expansion of Internet applications, is in a great stage of development. To cut down the resource expenditure with a reasonable implementation planning, an IoT-based smart energy consumption controlling and energy supervisory method has been proposed by investigating the energy use of a house [17]. Literature [18] designed a refreshing pattern, 5G Intelligent Internet of Things (5G I-IoT), to handle big data and promote communication channels effectively. IoT is a catalyst for the generation of big data because big data originates from the application of IoT. The use of IoT gives birth to large amount of data which contains significant information. The fast development of IoT and big data is owing to 5G communication.


### 2.2. Research on Stock Forecasting

As an important part of capital market construction, the change of stock market is of extraordinary significance to national macroeconomic development, financial institutions, and individuals. The high instability and nondeterminacy of stock price make it a difficult matter in the domain of finance and data mining. Thus, forecasting stock prices in order to avoid the investment risk to the greatest extent and improve the investment returns becomes the latest research focus.Traditional forecasting methods have the limitations to balance the randomness and regularity of controlling price changes [19]. In recent years, the artificial neural network (ANN) has achieved remarkable results in the field of artificial intelligence algorithm whose predictive analysis capability has greatly promoted the application of technologies like big data. So stock forecasting methods based on ANN and related technologies have been widely studied, which make up for the shortcomings of traditional forecasting techniques and increase the reliability and accuracy of stock forecasting [20]. Literature [21] implements an LSTM model on time series trend forecasting problems, and the results outperform that of the conventional autoregression models. Moreover, some portfolio models have been applied to stock trend prediction. They all achieved good results. Literature [22] combines price prediction based on historical and real-time data along with news analysis, and LSTM was used for predicting; this approach incorporated into the existing strategies will encourage quant traders to invest and maximize their profit. In literature [23], a deep learning method for stock price prediction was proposed. In this literature, a total of 14 different deep learning models were presented and all stocks in the Standard & Poor’s (S&P) BSE-BANKEX index were evaluated.


## 2.1. The Integration Development of 5G, IoT, and Deep Learning

5G is aimed at providing super ultralow delay technological schemes as well as fiber-like access data transmission speed, to connect over 100 billion facilities and deliver accordant experience across multiplex scenarios with improved capability and spend efficiency [9]. 5G mobile communication technology improves customer experience and system safety of communication technology, so it has been widely used in all walks of life [10]. A 5G-enabled IoT is devised to convey both 5G and IoT information and at the same time to reduce the whole IoT power consumption while maintaining 5G and IoT transmission rates steady [11]. 5G-enabled emotion-aware linked healthcare big data was designed. The proposed method will greatly promote 5G-based individualized and corresponding emotion-aware medical services [12]. With the development and popularization of 5G technology and IoT, new data mining algorithms were boosted [13]. Big data, IoT, and 5G are closely related to each other, for big data stems from the application of IoT technology.5G will prove to be the mainstay of IoT, providing full links to all “things,” surmounting place restrictions on time-space, and bringing about comprehensive, service-customized, and user-centric interconnections [14]. The relationship between 5G, IoT, and deep learning is shown in Figure 1. As shown in Figure 1, the entire system of the IoT constitutes three layers, namely, the perceptual layer, the transport layer, and the application layer. 5G communication provides technical support for network layer transmission. In the big data era, not all massive data are valuable. What is more important is to mine useful data via the deep learning algorithm. Among them, large data analysis methods based on deep learning have been developed more rapidly.Figure 1
The relationship between 5G, IoT, and deep learning.The development of 5G communication technology and IoT enables the application of the neural network and deep learning. IoT is extensively used in various fields, such as intelligent logistics, smart healthcare, pilotless driving, industrial automation, and global positioning system (GPS) data aggregation [15]. Based on 5G communication agreements and data interchange criterion, with the convergence of the IoT and artificial intelligence (AI), the smart network performs much better communicating ability. To build an efficient intrusion detection system over big data, literature [16] proposed a classification algorithm based on data clustering and data reduction. IoT, as an expansion of Internet applications, is in a great stage of development. To cut down the resource expenditure with a reasonable implementation planning, an IoT-based smart energy consumption controlling and energy supervisory method has been proposed by investigating the energy use of a house [17]. Literature [18] designed a refreshing pattern, 5G Intelligent Internet of Things (5G I-IoT), to handle big data and promote communication channels effectively. IoT is a catalyst for the generation of big data because big data originates from the application of IoT. The use of IoT gives birth to large amount of data which contains significant information. The fast development of IoT and big data is owing to 5G communication.


## 2.2. Research on Stock Forecasting

As an important part of capital market construction, the change of stock market is of extraordinary significance to national macroeconomic development, financial institutions, and individuals. The high instability and nondeterminacy of stock price make it a difficult matter in the domain of finance and data mining. Thus, forecasting stock prices in order to avoid the investment risk to the greatest extent and improve the investment returns becomes the latest research focus.Traditional forecasting methods have the limitations to balance the randomness and regularity of controlling price changes [19]. In recent years, the artificial neural network (ANN) has achieved remarkable results in the field of artificial intelligence algorithm whose predictive analysis capability has greatly promoted the application of technologies like big data. So stock forecasting methods based on ANN and related technologies have been widely studied, which make up for the shortcomings of traditional forecasting techniques and increase the reliability and accuracy of stock forecasting [20]. Literature [21] implements an LSTM model on time series trend forecasting problems, and the results outperform that of the conventional autoregression models. Moreover, some portfolio models have been applied to stock trend prediction. They all achieved good results. Literature [22] combines price prediction based on historical and real-time data along with news analysis, and LSTM was used for predicting; this approach incorporated into the existing strategies will encourage quant traders to invest and maximize their profit. In literature [23], a deep learning method for stock price prediction was proposed. In this literature, a total of 14 different deep learning models were presented and all stocks in the Standard & Poor’s (S&P) BSE-BANKEX index were evaluated.


## 3. Stock Prediction Algorithms

### 3.1. Feature Selection

Machine learning is a process of data processing and model training. Data processing includes feature extraction and feature representation. In model training, there are a set of processes such as training strategy, training model, and algorithm correlation. A good prediction model is closely related to feature selection and feature representation. The method of feature selection is to select a subset from the original feature data set to reduce the number of attributes in the feature data set. The purpose of feature selection is to increase the accuracy of prediction, to design an efficient prediction model, and to have a better understanding and interpretation of the model as well.Optimal feature subset selection was performed using a correlation coefficient and feature importance ranking. The correlation coefficient is a quantity that studies the degree of linear correlation between variables. It is usually expressed by the letterr, which is shown in
(1)rX,Y=covX,YvarXvarY(2)covX,Y=∑i=1nxi−x¯yi−y¯n−1where covX,Y is the covariance of X and Y, varX is the variance of X, and varYis the variance of Y. rX,Y is a quantity that can characterize the degree of a close linear relationship between X and Y. If X and Y are not related, rX,Y=0. It is generally considered that there is no linear relationship between X and Y. If rX,Y≤1, it is generally considered that there is a linear relationship between X and Y. The closer the value of rX,Y is to 1, the more linear the two variables are. For each pair of highly correlated features, one of them is identified and removed.


### 3.2. LSTM Network

LSTM is a special type of recurrent neural network (RNN). It solves the problem of gradient explosion and gradient disappearance in the process of long-sequence RNN training. When the number of network layers increases, the perception ability of the following nodes to the front nodes becomes weak and the phenomenon that the previous information will be forgotten over time appears. LSTM adds memory units to each neuron unit of the hidden layer on the basis of ordinary RNN, so that the memory information on time series can be controlled. The schematic diagram of memory units of LSTM is shown in Figure2. Ct−1 and ht−1 represent the state of the memory unit at the last moment; Ct and ht represent the state of the hidden layer, respectively.Figure 2
LSTM memory unit structure diagram.Each time the input gateit, the forget gate ft, and the output gate ot are passed between the units, the memory and forgetting of the previous information and the current information can be controlled.The calculation formulas of the forget gateft, the input gate it, and the output gate otare defined in
(3)ft=σWxfxt+Whfht−1+bf,it=σWxixt+Whiht−1+bi,ot=σWxoxt+Whoht−1+bo.Among them,σ is the sigmoid activation function, xt is the input at time t, Wxf is the weight matrix from the input x to the forget gate ft, Whf is the weight matrix from the hidden layer state to the forgetting gate, and bf is the linear bias of the forgetting gate. Wxi is the weight matrix from the input x to the input gate, Whi is the weight matrix from the hidden state to the input gate, and bi is the linear bias of the input gate. Wxo is the weight matrix from the input to the output gate, Who is the weight matrix from the hidden state to the output gate, and bo is the linear bias of the output gate.The state value oft time memory unit ct consists of two parts: one is the state value of the memory unit at the previous time ct−1 and the other is the input gate waiting for update information c~t, which is controlled by the input gate and the forgetting gate, respectively. The current state of the memory unit ct can be obtained by calculating the following formula:
(4)c~t=tanhWxcxt+Whcht−1+bc,ct=it∗c~t+ft∗ct−1.Among them,Wxc is the weight matrix from input X to the memory unit, Whc is the weight matrix from the hidden layer to the memory unit, and bc is the linear bias of the memory unit.Finally, the current state of the hidden layerht is determined by the state of the output gate ot and the current storage unit ct. The calculation formula is shown in
(5)ht=ot∗tanhct.


## 3.1. Feature Selection

Machine learning is a process of data processing and model training. Data processing includes feature extraction and feature representation. In model training, there are a set of processes such as training strategy, training model, and algorithm correlation. A good prediction model is closely related to feature selection and feature representation. The method of feature selection is to select a subset from the original feature data set to reduce the number of attributes in the feature data set. The purpose of feature selection is to increase the accuracy of prediction, to design an efficient prediction model, and to have a better understanding and interpretation of the model as well.Optimal feature subset selection was performed using a correlation coefficient and feature importance ranking. The correlation coefficient is a quantity that studies the degree of linear correlation between variables. It is usually expressed by the letterr, which is shown in
(1)rX,Y=covX,YvarXvarY(2)covX,Y=∑i=1nxi−x¯yi−y¯n−1where covX,Y is the covariance of X and Y, varX is the variance of X, and varYis the variance of Y. rX,Y is a quantity that can characterize the degree of a close linear relationship between X and Y. If X and Y are not related, rX,Y=0. It is generally considered that there is no linear relationship between X and Y. If rX,Y≤1, it is generally considered that there is a linear relationship between X and Y. The closer the value of rX,Y is to 1, the more linear the two variables are. For each pair of highly correlated features, one of them is identified and removed.


## 3.2. LSTM Network

LSTM is a special type of recurrent neural network (RNN). It solves the problem of gradient explosion and gradient disappearance in the process of long-sequence RNN training. When the number of network layers increases, the perception ability of the following nodes to the front nodes becomes weak and the phenomenon that the previous information will be forgotten over time appears. LSTM adds memory units to each neuron unit of the hidden layer on the basis of ordinary RNN, so that the memory information on time series can be controlled. The schematic diagram of memory units of LSTM is shown in Figure2. Ct−1 and ht−1 represent the state of the memory unit at the last moment; Ct and ht represent the state of the hidden layer, respectively.Figure 2
LSTM memory unit structure diagram.Each time the input gateit, the forget gate ft, and the output gate ot are passed between the units, the memory and forgetting of the previous information and the current information can be controlled.The calculation formulas of the forget gateft, the input gate it, and the output gate otare defined in
(3)ft=σWxfxt+Whfht−1+bf,it=σWxixt+Whiht−1+bi,ot=σWxoxt+Whoht−1+bo.Among them,σ is the sigmoid activation function, xt is the input at time t, Wxf is the weight matrix from the input x to the forget gate ft, Whf is the weight matrix from the hidden layer state to the forgetting gate, and bf is the linear bias of the forgetting gate. Wxi is the weight matrix from the input x to the input gate, Whi is the weight matrix from the hidden state to the input gate, and bi is the linear bias of the input gate. Wxo is the weight matrix from the input to the output gate, Who is the weight matrix from the hidden state to the output gate, and bo is the linear bias of the output gate.The state value oft time memory unit ct consists of two parts: one is the state value of the memory unit at the previous time ct−1 and the other is the input gate waiting for update information c~t, which is controlled by the input gate and the forgetting gate, respectively. The current state of the memory unit ct can be obtained by calculating the following formula:
(4)c~t=tanhWxcxt+Whcht−1+bc,ct=it∗c~t+ft∗ct−1.Among them,Wxc is the weight matrix from input X to the memory unit, Whc is the weight matrix from the hidden layer to the memory unit, and bc is the linear bias of the memory unit.Finally, the current state of the hidden layerht is determined by the state of the output gate ot and the current storage unit ct. The calculation formula is shown in
(5)ht=ot∗tanhct.


## 4. Application of 5G and IoT in Stock Forecasting

IoT technology has penetrated into people’s production and life. With IoT technology, different types of data are exchanged and communicated through sensor nodes. Under the continuous development of IoT technology, IoT-based stock forecasting will become a new trend. It proves that it is feasible to mine useful information from stock historical data for stock prediction. The combination of 5G and IoT will promote the rapid development of stock forecasting industry. The application of 5G and IoT in stock forecasting is mainly reflected in the following aspects:(1)
In order to carry out data mining, data must be stored first. Unlike previous data storage methods, IoT stores scattered data in different network nodes to form virtual storage. Distributed storage makes it possible to exchange and share data between different regions and networks(2)
With the development of IoT, traditional methods will be replaced for it is hard to meet the requirements of data management and processing. The integration of 5G communication and IoT can build a secure, fast, and reliable transmission channel, therefore improving the time and efficiency of stock forecasting(3)
The IoT and 5G will continuously promote the automation of the stock forecasting system. By pushing relevant content to users’ mobile apps or other communication platforms, users can get the latest and most relevantly firsthand information at the fastest speed


## 5. Empirical Analysis

### 5.1. Data Preprocessing

From the Shenzhen Component Index market, this paper chooses the transaction data of Ping An Bank, Shenzhen Component Index, Petrochemical Machinery, and Jidian Shares from December 2, 2016, to May 31, 2019, as experimental subjects. The original data in this paper are all derived from the Tushare financial data package, which contains 608 trading days of transaction information. The first 90% data is selected as the training set and the last 10% data as the test set.Owing to the characteristics of intuition, concreteness, and easy application when judging the trend of stock market, technical indicators are widely used in stock market forecasting and analysis. Different technical indicators have their own scope of application and constraints. In the process of stock trend feature representation, a single technical index cannot guarantee the comprehensiveness and accuracy of the feature representation. Therefore, selecting several representative and easy-to-quantify technical indicators can improve the complementarity of data and the accuracy of feature representation. This paper constructs a feature set for forecasting based on 17 technical indicators (MA, CCI, ADX, RSI, ROC, AROONOSC, MOM, ATR, OSC, OBV, BOP, ULTOSC, MFI, ATR, K%, BETA, and CR) commonly used in stock market. These indicators comprehensively reflect the information of stock trend change and can include most of the influencing factors of stock trend forecasting. The final optimal feature subset is MA, RSI, CCI, K%, and CR, which can summarize most of the information of the original data. The expression of MA, RSI, CCI, K%, and CR is shown in(6)MA=∑i=1nCnn,RSI=100−1001+∑i=0n−1Upt−1/n/∑i=0n−1Dwt−i/n,CCI=Mt−SMt−10.015Dt,K%=∑i=1n2Ki−1+RSVi3,CR=∑i=0n−1Hi−Mi∑i=0n−1Mi−Li×100,where n denotes n day and Cn denotes the sum of n day closing prices. Upt is the increase of the first day compared with the previous day. Dwt is the decline of the first day compared with the previous day. Mt is the average of the highest, lowest, and closing prices. Ht and Lt indicate the highest and lowest price of t day, respectively.The selected data are used to construct the feature set. As the calculation methods of each index are different, the feature set constructed according to the technical index presents different range of values, of which the range varies greatly. The huge quantity difference will lead to the complexity of parameter optimization of the algorithm model, making it easy to overfit, which will have a negative impact on the final prediction results. Therefore, this paper uses formula (7) to normalize the feature quantities and convert each dimension feature component to −1,1.
(7)xd=vd−vd_minvd_max−vd_min.In the formula,vd_min is the minimum value of the d-dimensional eigenvalue and vd_max is the maximum value of the d-dimensional eigenvalue.


### 5.2. Stock Price Forecast

In order to test the effectiveness of the proposed method, the optimal feature subset is taken as input variable, the input time span is 30 days, and the opening price of the day is taken as output variable. The model consists of four layers: one LSTM layer and three dense layers. When training the LSTM model, dropout parameters and regular terms are added to avoid overfitting. The stock price of the test set is predicted by the trained model, and the traditional LSTM prediction model was compared. Mean absolute error (MAE), mean square error (MSE), and root mean square error (RMSE) were used as evaluation indexes to evaluate the validity of the model. The formulas for calculating the three evaluation indexes are shown in(8)MAE=1N∑i=1Nyi−y^i,MSE=1N∑i=1Nyi−yi^2,RMSE=1N∑i=1Nyi−yi^2.Among them,Yi and Y^i represent the true value and the predicted value, respectively.The predicted results of these four stocks are shown in Figures3–6, and the error analysis is shown in Tables 1 and 2. From Figures 3–6, it can be seen that the model can accurately predict the overall trend of four stock prices with different market capitalization scales. The predicted value of the FS-LSTM model is closer to the real value, indicating a better overall fitting effect. As can be seen from Tables 1 and 2, the prediction error of the FS-LSTM model is smaller compared with that of the traditional LSTM model. Comparatively, the prediction effect of the Shenzhen Component Index is the best which is attributed to the small stock price volatility. Using this model, the overall trend of stocks with different market values can also be accurately predicted, proving that the model can not only predict the stock price but also reliably predict the stock price of different scales, demonstrating its generalization and reliability. The application of the FS-LSTM model in stock forecasting can fully analyze the original data of stock and improve the forecasting accuracy of stock price. The experiment shows that the combination model has obvious advantages in dealing with data with many indexes and complex noise.Figure 3
Prediction result of Shenzhen Zhenye (Group).Figure 4
Prediction result of Ping An Bank.Figure 5
Prediction result of Sinopec Oilfield Equipment Corporation.Figure 6
Prediction result of Jilin Electric Power.Table 1
Stock prediction error table (LSTM).
Stock nameSinopec Oilfield Equipment CorporationJilin Electric PowerPing An BankShenzhen Zhenye (Group)MSE0.2600.0230.1900.052MAE0.4230.1130.3880.184RMSE0.5100.1520.4370.229Table 2
Stock prediction error table (FS-LSTM).
Stock nameSinopec Oilfield Equipment CorporationJilin Electric PowerPing An BankShenzhen Zhenye (Group)MSE0.1230.0160.0520.033MAE0.2800.0930.1790.143RMSE0.3510.0120.2300.182


## 5.1. Data Preprocessing

From the Shenzhen Component Index market, this paper chooses the transaction data of Ping An Bank, Shenzhen Component Index, Petrochemical Machinery, and Jidian Shares from December 2, 2016, to May 31, 2019, as experimental subjects. The original data in this paper are all derived from the Tushare financial data package, which contains 608 trading days of transaction information. The first 90% data is selected as the training set and the last 10% data as the test set.Owing to the characteristics of intuition, concreteness, and easy application when judging the trend of stock market, technical indicators are widely used in stock market forecasting and analysis. Different technical indicators have their own scope of application and constraints. In the process of stock trend feature representation, a single technical index cannot guarantee the comprehensiveness and accuracy of the feature representation. Therefore, selecting several representative and easy-to-quantify technical indicators can improve the complementarity of data and the accuracy of feature representation. This paper constructs a feature set for forecasting based on 17 technical indicators (MA, CCI, ADX, RSI, ROC, AROONOSC, MOM, ATR, OSC, OBV, BOP, ULTOSC, MFI, ATR, K%, BETA, and CR) commonly used in stock market. These indicators comprehensively reflect the information of stock trend change and can include most of the influencing factors of stock trend forecasting. The final optimal feature subset is MA, RSI, CCI, K%, and CR, which can summarize most of the information of the original data. The expression of MA, RSI, CCI, K%, and CR is shown in(6)MA=∑i=1nCnn,RSI=100−1001+∑i=0n−1Upt−1/n/∑i=0n−1Dwt−i/n,CCI=Mt−SMt−10.015Dt,K%=∑i=1n2Ki−1+RSVi3,CR=∑i=0n−1Hi−Mi∑i=0n−1Mi−Li×100,where n denotes n day and Cn denotes the sum of n day closing prices. Upt is the increase of the first day compared with the previous day. Dwt is the decline of the first day compared with the previous day. Mt is the average of the highest, lowest, and closing prices. Ht and Lt indicate the highest and lowest price of t day, respectively.The selected data are used to construct the feature set. As the calculation methods of each index are different, the feature set constructed according to the technical index presents different range of values, of which the range varies greatly. The huge quantity difference will lead to the complexity of parameter optimization of the algorithm model, making it easy to overfit, which will have a negative impact on the final prediction results. Therefore, this paper uses formula (7) to normalize the feature quantities and convert each dimension feature component to −1,1.
(7)xd=vd−vd_minvd_max−vd_min.In the formula,vd_min is the minimum value of the d-dimensional eigenvalue and vd_max is the maximum value of the d-dimensional eigenvalue.


## 5.2. Stock Price Forecast

In order to test the effectiveness of the proposed method, the optimal feature subset is taken as input variable, the input time span is 30 days, and the opening price of the day is taken as output variable. The model consists of four layers: one LSTM layer and three dense layers. When training the LSTM model, dropout parameters and regular terms are added to avoid overfitting. The stock price of the test set is predicted by the trained model, and the traditional LSTM prediction model was compared. Mean absolute error (MAE), mean square error (MSE), and root mean square error (RMSE) were used as evaluation indexes to evaluate the validity of the model. The formulas for calculating the three evaluation indexes are shown in(8)MAE=1N∑i=1Nyi−y^i,MSE=1N∑i=1Nyi−yi^2,RMSE=1N∑i=1Nyi−yi^2.Among them,Yi and Y^i represent the true value and the predicted value, respectively.The predicted results of these four stocks are shown in Figures3–6, and the error analysis is shown in Tables 1 and 2. From Figures 3–6, it can be seen that the model can accurately predict the overall trend of four stock prices with different market capitalization scales. The predicted value of the FS-LSTM model is closer to the real value, indicating a better overall fitting effect. As can be seen from Tables 1 and 2, the prediction error of the FS-LSTM model is smaller compared with that of the traditional LSTM model. Comparatively, the prediction effect of the Shenzhen Component Index is the best which is attributed to the small stock price volatility. Using this model, the overall trend of stocks with different market values can also be accurately predicted, proving that the model can not only predict the stock price but also reliably predict the stock price of different scales, demonstrating its generalization and reliability. The application of the FS-LSTM model in stock forecasting can fully analyze the original data of stock and improve the forecasting accuracy of stock price. The experiment shows that the combination model has obvious advantages in dealing with data with many indexes and complex noise.Figure 3
Prediction result of Shenzhen Zhenye (Group).Figure 4
Prediction result of Ping An Bank.Figure 5
Prediction result of Sinopec Oilfield Equipment Corporation.Figure 6
Prediction result of Jilin Electric Power.Table 1
Stock prediction error table (LSTM).
Stock nameSinopec Oilfield Equipment CorporationJilin Electric PowerPing An BankShenzhen Zhenye (Group)MSE0.2600.0230.1900.052MAE0.4230.1130.3880.184RMSE0.5100.1520.4370.229Table 2
Stock prediction error table (FS-LSTM).
Stock nameSinopec Oilfield Equipment CorporationJilin Electric PowerPing An BankShenzhen Zhenye (Group)MSE0.1230.0160.0520.033MAE0.2800.0930.1790.143RMSE0.3510.0120.2300.182


## 6. Conclusion

Firstly, this paper analyzes the impact of 5G development on the IoT. The integration of 5G, IoT, and deep learning is a new development trend. 5G and IoT have many advantages in stock forecasting. Then, this paper presents a FS-LSTM combination model based on feature selection and LSTM prediction for stock trend prediction. The optimal feature subset for stock trend prediction is obtained through feature selection. The prediction effect of the optimal feature subset is verified by the test set. The experimental results show that the forecasting model proposed in this paper is superior to the traditional LSTM forecasting model in terms of forecasting effect. Using this method, the best feature subset for forecasting can be found and the impact of redundant information on stock trend forecasting can be reduced. As a result, the accuracy of forecasting is improved. Finally, the application of 5G and IoT in stock forecasting is analyzed.Stock market is a complex and dynamic system. The shortcoming of this work is that this paper is only based on technical indicators and does not consider other factors. The future work involves including newly developed computing models. The future work also involves minimizing computation time of FS-LSTM. It is concluded that 5G, IoT, and stock forecasting will be more closely linked in the future.



---

*Source: 7681209-2020-06-20.xml*