# A Study of Stock Market Predictability Based on Financial Time Series Models

Authors: Yan Yu
Journal: Mobile Information Systems
 (2022)

---

## Abstract

In today’s era of economic globalization and financial integration, the stock market is constantly complex, showing many deviations that cannot be explained by classical financial analysis, but at the same time, some classic financial statistical features have striking similarities. This suggests that although the stock market is intricate, there are universal laws that can be found through data mining to find its underlying operating rules. In this paper, we construct financial time series models such as ARIMA, ARCH, and GARCH to predict the stock market price fluctuations and trends. The ARIMA model is used to fit the linear financial time series, and the GARCH model is used to fit the nonlinear time series residuals. The results show that the integrated tree model based on the idea of weight voting has high accuracy in predicting stock market bulls and bears, with XGBoost prediction accuracy up to 96%, and the neural network model is also very effective, with an accuracy rate of over 90%.


---

## Body

## 1. Introduction

In today’s globalized economy and financial integration, the stock market is continuously complicated, presenting many deviations that classical financial analysis and economic theory are unable to explain. Specifically, the ideal market described under the efficient market hypothesis is not fully fitted to the actual stock market and sometimes even completely deviates from it. The high intelligence, strong volatility, tight coupling, and asymmetry exhibited by the stock market make it a complex nonlinear and nonstationary financial system [1–3]. However, at the same time, some classical financial statistical features such as stock indices, volume and price transformations, and volatility have striking similarities. This suggests that although the stock market is a complex financial system, there may be some universal laws hidden in the ocean of data. The statistical characteristics of certain observed variables in the stock market can be explored to uncover the statistical laws behind them so that we can clarify the mechanism of stock market movement and find the laws behind its operation [4–6]. Based on this, this paper will use machine learning algorithms, financial time series, and deep neural networks to construct statistical models to describe such a complex nonlinear and asymmetric financial system in detail and reveal the underlying mechanisms and laws of financial time series operation, which is undoubtedly of great practical significance and theoretical value for people to prevent financial risks and regulate financial markets, which is also the significance and background of this research paper.


## 2. Related Work

In a market economy, the stock market, especially the stock market, is an important part of the national economy and a barometer reflecting the macroeconomic dynamics, and its dynamics are closely related to the overall macroeconomic development [7]. The accurate prediction of the stock market has always been an important field of inquiry in the industry and academia, especially in recent years, the stock market is volatile, and many authoritative experts and scholars at home and abroad have devoted themselves to predictive research of the financial stock market [8].


### 2.1. Financial Time Series Modeling Analysis

Time series analysis is the use of statistical means to analyze the past of a series, model the changing characteristics of the variable, and predict the future. Time series analysis has a wide range of applications in economics, and the progress of financial time series analysis research can be roughly seen from the chronology of the following events. In the study of U.S. stock returns, the time series heteroskedasticity of the variance of stock returns was found by comparing the correlation of the returns of various stock indices [9]. Based on this, financial scholars began to focus on financial time series analysis and tried to introduce time series into the stock market metrics, and volatility analysis models closely related to this emerged, the most dazzling of which is the ARCH-type model proposed by the authors of [10]. In the analysis of foreign exchange market risk volatility and when analyzing the risk volatility and returns in the foreign exchange market, considering that the risk premium cannot be measured, a new model was constructed by explaining the risk premium in terms of conditional variance values, and the valuation eventually fitted well. Later, the authors in [11] proposed the GARCH cluster model, which extends the modeling with the influence no longer limited to the conditional variance but to the prelate conditional variance or the mean squared error [12]. In [13], an ARCH/GARCH model with GED distribution is proposed and applied to the study of time series heteroskedasticity. Through a series of empirical tests, it is found that the composite model with GED distribution features has stronger financial time series forecasting performance than the traditional ARCH and GARCH models.


### 2.2. Deep Learning in the Stock Market

With the rise of big data and artificial intelligence, scholars have gradually introduced machine learning algorithms into stock market predictive research. The authors in [14] used traditional financial time series analysis and the LSTM model to extend the prediction of the S&P500 index, respectively, and the empirical conclusion showed that the price prediction performance of the LSTM model was much better than that of the GARCH model under the condition of setting specific parameters. In [15], the LSTM deep neural network model and the traditional neural network model (e.g., BP neural network and RNN) were constructed to conduct a comprehensive comparative study on the CSI 300 index. In [16], the LSTM deep neural network model was built to predict stock price volatility, and financial time series analysis was introduced on top of it to build a hybrid model to predict the closing price; the prediction results showed that the hybrid model had significantly improved prediction performance compared with traditional time series analysis and neural network models. The authors in [17] used LSTM deep neural networks for forecasting short-term trends in the stock market. This literature used nearly 10 years of stock data from the market as a dataset to construct a long and short-term memory network with a multiclass feature system, which overcomes the common drawback of local minimum rather than the global minimum in neural network models and compares it with commonly used models such as CNN, RNN, and multilayer perceptron (MLP), and the empirical findings show that LSTM achieves superior forecasting performance with prediction, high accuracy, and fast convergence and has a wide range of application prospects. The authors in [18] quantified investor sentiment indices by BiLSTM used CLSTM to classify the sentiment of word features of news and constructed a hybrid LSTM to predict stock market trend changes. The authors in [19] applied machine learning algorithms to time series analysis, based on the improved XGBoost algorithm, phase space reconstruction optimization method, and improved SVR model for stock index regression prediction, and the experimental results showed that the machine learning algorithm can significantly achieve the classification prediction in the stock index, but the numerical prediction effect is not significant.


## 2.1. Financial Time Series Modeling Analysis

Time series analysis is the use of statistical means to analyze the past of a series, model the changing characteristics of the variable, and predict the future. Time series analysis has a wide range of applications in economics, and the progress of financial time series analysis research can be roughly seen from the chronology of the following events. In the study of U.S. stock returns, the time series heteroskedasticity of the variance of stock returns was found by comparing the correlation of the returns of various stock indices [9]. Based on this, financial scholars began to focus on financial time series analysis and tried to introduce time series into the stock market metrics, and volatility analysis models closely related to this emerged, the most dazzling of which is the ARCH-type model proposed by the authors of [10]. In the analysis of foreign exchange market risk volatility and when analyzing the risk volatility and returns in the foreign exchange market, considering that the risk premium cannot be measured, a new model was constructed by explaining the risk premium in terms of conditional variance values, and the valuation eventually fitted well. Later, the authors in [11] proposed the GARCH cluster model, which extends the modeling with the influence no longer limited to the conditional variance but to the prelate conditional variance or the mean squared error [12]. In [13], an ARCH/GARCH model with GED distribution is proposed and applied to the study of time series heteroskedasticity. Through a series of empirical tests, it is found that the composite model with GED distribution features has stronger financial time series forecasting performance than the traditional ARCH and GARCH models.


## 2.2. Deep Learning in the Stock Market

With the rise of big data and artificial intelligence, scholars have gradually introduced machine learning algorithms into stock market predictive research. The authors in [14] used traditional financial time series analysis and the LSTM model to extend the prediction of the S&P500 index, respectively, and the empirical conclusion showed that the price prediction performance of the LSTM model was much better than that of the GARCH model under the condition of setting specific parameters. In [15], the LSTM deep neural network model and the traditional neural network model (e.g., BP neural network and RNN) were constructed to conduct a comprehensive comparative study on the CSI 300 index. In [16], the LSTM deep neural network model was built to predict stock price volatility, and financial time series analysis was introduced on top of it to build a hybrid model to predict the closing price; the prediction results showed that the hybrid model had significantly improved prediction performance compared with traditional time series analysis and neural network models. The authors in [17] used LSTM deep neural networks for forecasting short-term trends in the stock market. This literature used nearly 10 years of stock data from the market as a dataset to construct a long and short-term memory network with a multiclass feature system, which overcomes the common drawback of local minimum rather than the global minimum in neural network models and compares it with commonly used models such as CNN, RNN, and multilayer perceptron (MLP), and the empirical findings show that LSTM achieves superior forecasting performance with prediction, high accuracy, and fast convergence and has a wide range of application prospects. The authors in [18] quantified investor sentiment indices by BiLSTM used CLSTM to classify the sentiment of word features of news and constructed a hybrid LSTM to predict stock market trend changes. The authors in [19] applied machine learning algorithms to time series analysis, based on the improved XGBoost algorithm, phase space reconstruction optimization method, and improved SVR model for stock index regression prediction, and the experimental results showed that the machine learning algorithm can significantly achieve the classification prediction in the stock index, but the numerical prediction effect is not significant.


## 3. Handling of Stock Trading Indicators

### 3.1. Selection of Stock Trading Indicators

The stock closing price is used as the prediction data of the LSTM deep neural network, so the influencing factors related to the stock closing price movement are selected as the input data. The factors affecting the stock closing price changes are divided into three categories: the first category is the basic stock trading data; the second category is the stock technical index data, such as MA, KDJ, and turnover rate [20]. The detailed selection of indicators is shown in Table 1.Table 1
The technical indicators for stock trading.
Transaction indicator categoryStock trading indexAbbreviation of stock trading index dataBasic transaction indicatorsOpening priceOpenClosing priceCloseHighest priceHighMinimum priceLowTurnoverVolumeDecline or increaseP_changeTransaction technical indicatorsSimple moving averageMA_5,MA_10,MA_30Smooth change averageMACD,DIF,DEAAverage line difference indexDMA,AMAExponential moving averageEMA_12,EMA_26Interval oscillation indexDPORandom indexKDJ_K, KDJ_D, KDJ_JBrin line indexUP,DNEnergy tide indexOBVPrice change indexROCPsychological line indexRSYEmotional indicatorsAR,BRRelative strength indexRSIWilliam variation dispersionWAVDDeviation rate indexBIAS_6, BIAS_12, BIAS_24Mic support pressure indexWEKP, MIDR,STOPWEKP, MIDR,STOS


### 3.2. Data Processing

In this paper, we use LSTM deep neural network to predict stock prices based on multiple independent variables of trading indicators, but there are strong correlations among independent variables of trading indicators and too many input variables make the prediction problem more difficult. Therefore, principal component analysis is chosen to correlate the stock trading indicator variables, which can reduce the dimensionality of the trading indicator variables and still retain the main information of the trading indicator variables. The principal component analysis process of the stock trading technical indicator is shown in Figure1.Figure 1
Diagram of the execution steps of principal component analysis of technical indicators for stock trading.


## 3.1. Selection of Stock Trading Indicators

The stock closing price is used as the prediction data of the LSTM deep neural network, so the influencing factors related to the stock closing price movement are selected as the input data. The factors affecting the stock closing price changes are divided into three categories: the first category is the basic stock trading data; the second category is the stock technical index data, such as MA, KDJ, and turnover rate [20]. The detailed selection of indicators is shown in Table 1.Table 1
The technical indicators for stock trading.
Transaction indicator categoryStock trading indexAbbreviation of stock trading index dataBasic transaction indicatorsOpening priceOpenClosing priceCloseHighest priceHighMinimum priceLowTurnoverVolumeDecline or increaseP_changeTransaction technical indicatorsSimple moving averageMA_5,MA_10,MA_30Smooth change averageMACD,DIF,DEAAverage line difference indexDMA,AMAExponential moving averageEMA_12,EMA_26Interval oscillation indexDPORandom indexKDJ_K, KDJ_D, KDJ_JBrin line indexUP,DNEnergy tide indexOBVPrice change indexROCPsychological line indexRSYEmotional indicatorsAR,BRRelative strength indexRSIWilliam variation dispersionWAVDDeviation rate indexBIAS_6, BIAS_12, BIAS_24Mic support pressure indexWEKP, MIDR,STOPWEKP, MIDR,STOS


## 3.2. Data Processing

In this paper, we use LSTM deep neural network to predict stock prices based on multiple independent variables of trading indicators, but there are strong correlations among independent variables of trading indicators and too many input variables make the prediction problem more difficult. Therefore, principal component analysis is chosen to correlate the stock trading indicator variables, which can reduce the dimensionality of the trading indicator variables and still retain the main information of the trading indicator variables. The principal component analysis process of the stock trading technical indicator is shown in Figure1.Figure 1
Diagram of the execution steps of principal component analysis of technical indicators for stock trading.


## 4. LSTM Model Design

The number of hidden layers and nodes of the hidden layers of the stock prediction model and the selection of optimization methods need to be analyzed and designed in detail to improve the performance of the stock prediction model [21], and the process is shown in Figure 2.Figure 2
Data mining process.If the nodes of the hidden layer of the stock prediction model are too few, the features of the technical data of stock trading will not be learned enough; if the number of nodes of the hidden layer is too many, the prediction model will be overfitted [22]. For the prediction model with two hidden layers, the prediction model works best when the two hidden layer nodes are similar, so in this paper, the number of hidden layer nodes of the stock prediction model is initially set to 64, as shown in Figure 3 of this paper LSTM model.Figure 3
LSTM model in this paper.By analyzing and studying the stock data and optimization methods, the RMSprop (Root Mean Square Prop) method is chosen for the optimization training of the LSTM deep neural network.We use LSTM to eliminate errors in communication at the obtained original correlation points, and the original communication has multiple or error correspondence due to factors such as noise and similar characteristics. These incorrect corresponding points affect the quality of the transformation matrix, thus reducing the adjustment accuracy. Therefore, errors related to exclusion strategies are often used to improve the situation. Therefore, this paper adopts LSTM to eliminate errors in the communication system as follows. First, we calculate the initial corresponding point on the residual value of concentration to determine whether it meets the transformation matrix when setting the threshold value. If the distance between the points through matrix transformation is less than the given threshold, the point pair is correct, which is written as “internal point pair,” and the internal point is written as “internal point pair center”; otherwise, for points written as “external point pairs,” the corresponding points will be wrong. Then, we output the “inner point pair set” with the largest number of corresponding point pairs, use this “inner point pair set” as the final correct corresponding point pair set, and then use the corresponding point pair set to calculate the transformation matrix.To eliminate the error and find the correct point matching through LSTM, this paper uses the dual quaternion method to solve the transformation matrix and uses the transformation matrix to realize the accurate distribution of clouds around the laser array. The specific solution is as follows:(1)
Represent the point in quaternion form:(1)p˙i=0xiyiziT,q˙Ti=0xTiyTizTiT.(2)
Build a matrixWp˙i,Qq˙Ti with quaternion points:(2)Wp˙i=0−xi−yi−zixi0zi−yiyi−zi0xiziyi−xi0,Qq˙Ti=0−xTi−yTi−zTixTi0−zTiyTiyTizTi0−xTizTi−yTixTi0.(3)
Calculate the matrixC1,C2:(3)C1=−2∑i=1np¯iQq˙πTWp˙i,C2=4∑i=1np¯iWp˙iT−Qq˙πT.(3)
Calculate the matrixM:(4)M=12C1C2T8∑i=1np¯i−C1+C1T.(5)
Calculate the eigenvector corresponding to the maximum eigenvalue of the matrix, this vector is the real partr˙ of the dual quaternion, and calculate the imaginary part q˙ of the dual quaternion:(5)r˙=or1r2r3T,q˙=−C2Tr˙8∑i=1np¯i,wherer˙Tr˙=1,r˙Tq˙=0.(6)
Construct the matrixWr˙Qr˙:(6)Wr˙=r0−r1−r2−r3r10r3−r2r2−r30r1r3r2−r10,Qr˙=r0−r1−r2−r3r10−r3r2r2r30−r1r3−r2r10.(7)
Find theR and the vector T:(7)100R=WrTQr,0T=2WrTq˙.


## 5. Experimental Results and Analysis

The stock closing price prediction study is conducted by selecting investable stocks from the stock selection results of the stock selection model. The basic data of stock trading are obtained from the Oriental Wealth data source through a crawler program. Since the Chinese stock market system was reformed in 2005, this paper selects the basic data of stock trading from the beginning of 2006 to the end of 2018 and uses 500000-Pufa Bank as a sample for detailed prediction analysis. Table2 shows the sample of basic stock trading data.Table 2
Sample table of basic stock trading data.
CodeDateOpenHighCloseLowVolumeRice_ changeP_change5000002018/10/3110.9911.0310.8910.87217371.10.030.27The stock price prediction model uses the stock data of the previous N days to predict the closing price of theN+1th day, and the initial N value is 10. The stock technical indicator data need to be obtained according to the calculation formula of the trading technical indicators and combined with the basic stock trading data to form the stock trading indicator dataset. The range of each stock trading indicator and the unit of measurement of the indicator are different, so all the stock trading indicators need to be standardized, and the standardized data are divided into input data of sequence length N. The closing price of the next day of each sample data is selected as the prediction value of the stock data samples.Finally, the trainable stock data samples are randomly disrupted, and then, 80% of the stock data samples are selected as training data; the remaining 20% of the stock data samples are used as test data to evaluate the prediction effect of the stock price prediction model.


### 5.1. Experimental Analysis of Stock Trading Indicator Selection

There are many factors affecting stock prices in the stock market. In this paper, we select the basic trading data and technical indicators data related to stock trading to construct stock prediction models. These two types of stock data are used to design the following 3 stock price forecasting models to select the best input features.As can be seen from Table3, the coefficient of determination of prediction model M1 with basic stock trading data as input features is 88.9%, and the root mean square error is 0.874, so the stock price prediction using basic stock trading data is effective; the coefficient of determination of prediction model M2 with stock trading technical indicators as input features is 85.8%, and the root mean square error is 0.988, compared with M1 The forecasting effect of forecasting model M2 is significantly lower than that of M1.Table 3
Table of stock price forecast results for stock trading indicators.
Stock forecasting modelInput feature dimensionSelection of stock trading indicatorsRMSER2M16Basic data of stock trading0.87588.8%M232Technical indicators of stock trading0.98985.9%M338Basic data and technical indicators of stock trading0.9188.3%The stock trading technical indicators are obtained based on the technical indicator formula, which makes the stock trading technical indicators somewhat loss of information on the basic stock trading data. From Figures4 to 6, it can be seen that M2 has a large loss error compared to the M1 model, and for the training data, the prediction model reaches stability quickly, while the validation data are more unstable. From the stock market theory, it can be seen that the stock trading technical indicators contain limited information, and the stock market in China has a 10% limit on the increase or decrease of stock prices, while the stock trading technical indicators do not have such a limit, which makes them fluctuate widely. Therefore, the limited information contained in the technical indicators of stock trading and their large variation lead to the ineffectiveness of the M2 model.Figure 4
Training effect of model M1.Figure 5
Training effect of model M2.Figure 6
Training effect of model M3.As can be seen from Table3, the coefficient of determination of prediction model M3 with basic stock trading data and stock trading technical indicators as input features is 88.2%, which is slightly less than that of prediction model M1. Comparing Figures 4 and 6, it can be seen that the prediction model M3 with a larger dimension of input features has a slightly higher loss error. It can be inferred that the learning ability of the training process of the prediction model is reduced when the information of the stock input feature data is redundant.Therefore, for LSTM deep neural network training of the stock price prediction model, appropriately increasing the effective information of stocks can improve the prediction effect of the prediction model, but when the added stock data dimension is too large and the stock information is redundant, it seriously affects the stock prediction effect.


### 5.2. Experimental Analysis of Principal Component Processing of Stock Trading Technical Indicators

From the selection of stock trading indicators, we can see that the input features of the LSTM deep neural network are too large in dimension and contain a lot of redundant information, which affects the prediction results of the stock price prediction model. Therefore, the principal component analysis method is selected to reduce the dimensionality of the stock trading index data of the M3 model, and the processed stock trading index data are input to the LSTM deep neural network to build the stock price prediction model.In the principal component analysis of stock data, 85% of the stock information is retained, the dimensionality of stock trading index data is reduced to 11 dimensions, and the selected stock trading data are used as the input features of the stock price prediction model to construct the stock price prediction model M3_PCA(85). To verify the effect of the amount of stock information retained after principal component analysis on the prediction effect of the stock prediction model, 90% of the stock information is retained when using principal component analysis on the stock trading indicator data, and the selected stock data are used as the input data for the LSTM deep neural network to construct the stock prediction model M3-PCA(90).As can be seen from Table4, the prediction model M3-PCA(80), which is built after principal component analysis of trading technical indicator data, has a prediction model coefficient of determination of 91.3%, which is 3.1 percentage points higher than that of prediction model M3, and the root mean square error is also reduced by 0.142. Comparing Figures 7 and 8, it can be seen that the prediction model M3-PCA(90) has a large fluctuation in the loss error, and the model prediction effect is not stable. It can be seen that the prediction effect of the stock price prediction model constructed by the LSTM deep neural network can be improved after performing principal component analysis on the input features with higher data dimensionality and a strong correlation between the data. In contrast, the coefficient of determination of M3-PCA(90) has decreased and the mean square error has increased, so when too much information is kept in the principal component analysis stock data, it will reduce the prediction effect of the stock price prediction model.Table 4
Table of stock price forecasts processed by principal components of stock trading technical indicators.
Stock forecasting modelInput feature dimensionInput feature selectionRMSER2M338Transaction basic indicators and transaction technical indicators0.8988.1%M3-PCA(80)11Retain 80% of feature information0.75491.2%M3-PCA(90)15Retain 90% of feature information0.87490.0%Figure 7
Training effect of model M3-PCA(80).Figure 8
Training effect of model M3-PCA(90).


### 5.3. Experimental Analysis of Stock Time Series Length Selection

In the LSTM neural network to construct stock prediction models, the length of the time series is one of the factors that affect the prediction effect of the stock prediction model. According to the experimental results in the first two sections, the trading index data after principal component analysis are selected as input variables, and the data are processed into time series of lengths 5, 10, 20, and 30, respectively, to build the model for training, and the prediction results are shown in Table5.Table 5
Results for the effect of time series length on stock price models.
Prediction modelSequence lengthRMSER2M3-PCA(80)-d550.89288.3%M3-PCA(80)-d10100.75891.2%M3-PCA(80)-d20200.76190.8%M3-PCA(80)-d30300.77290.1%As can be seen from Table5, the coefficient of determination of the prediction models with sequence lengths of 20 and 30 decreases compared with those of the other prediction models, while the model with a sequence length of 10 has the best prediction effect. This indicates that when the time series length is short, the forecasting model does not learn enough useful information from the stock data samples; when the time series length is long, the forecasting model learns too much information from the training samples and may learn some noisy information into the forecasting model as well, causing the forecasting model to become less effective.


## 5.1. Experimental Analysis of Stock Trading Indicator Selection

There are many factors affecting stock prices in the stock market. In this paper, we select the basic trading data and technical indicators data related to stock trading to construct stock prediction models. These two types of stock data are used to design the following 3 stock price forecasting models to select the best input features.As can be seen from Table3, the coefficient of determination of prediction model M1 with basic stock trading data as input features is 88.9%, and the root mean square error is 0.874, so the stock price prediction using basic stock trading data is effective; the coefficient of determination of prediction model M2 with stock trading technical indicators as input features is 85.8%, and the root mean square error is 0.988, compared with M1 The forecasting effect of forecasting model M2 is significantly lower than that of M1.Table 3
Table of stock price forecast results for stock trading indicators.
Stock forecasting modelInput feature dimensionSelection of stock trading indicatorsRMSER2M16Basic data of stock trading0.87588.8%M232Technical indicators of stock trading0.98985.9%M338Basic data and technical indicators of stock trading0.9188.3%The stock trading technical indicators are obtained based on the technical indicator formula, which makes the stock trading technical indicators somewhat loss of information on the basic stock trading data. From Figures4 to 6, it can be seen that M2 has a large loss error compared to the M1 model, and for the training data, the prediction model reaches stability quickly, while the validation data are more unstable. From the stock market theory, it can be seen that the stock trading technical indicators contain limited information, and the stock market in China has a 10% limit on the increase or decrease of stock prices, while the stock trading technical indicators do not have such a limit, which makes them fluctuate widely. Therefore, the limited information contained in the technical indicators of stock trading and their large variation lead to the ineffectiveness of the M2 model.Figure 4
Training effect of model M1.Figure 5
Training effect of model M2.Figure 6
Training effect of model M3.As can be seen from Table3, the coefficient of determination of prediction model M3 with basic stock trading data and stock trading technical indicators as input features is 88.2%, which is slightly less than that of prediction model M1. Comparing Figures 4 and 6, it can be seen that the prediction model M3 with a larger dimension of input features has a slightly higher loss error. It can be inferred that the learning ability of the training process of the prediction model is reduced when the information of the stock input feature data is redundant.Therefore, for LSTM deep neural network training of the stock price prediction model, appropriately increasing the effective information of stocks can improve the prediction effect of the prediction model, but when the added stock data dimension is too large and the stock information is redundant, it seriously affects the stock prediction effect.


## 5.2. Experimental Analysis of Principal Component Processing of Stock Trading Technical Indicators

From the selection of stock trading indicators, we can see that the input features of the LSTM deep neural network are too large in dimension and contain a lot of redundant information, which affects the prediction results of the stock price prediction model. Therefore, the principal component analysis method is selected to reduce the dimensionality of the stock trading index data of the M3 model, and the processed stock trading index data are input to the LSTM deep neural network to build the stock price prediction model.In the principal component analysis of stock data, 85% of the stock information is retained, the dimensionality of stock trading index data is reduced to 11 dimensions, and the selected stock trading data are used as the input features of the stock price prediction model to construct the stock price prediction model M3_PCA(85). To verify the effect of the amount of stock information retained after principal component analysis on the prediction effect of the stock prediction model, 90% of the stock information is retained when using principal component analysis on the stock trading indicator data, and the selected stock data are used as the input data for the LSTM deep neural network to construct the stock prediction model M3-PCA(90).As can be seen from Table4, the prediction model M3-PCA(80), which is built after principal component analysis of trading technical indicator data, has a prediction model coefficient of determination of 91.3%, which is 3.1 percentage points higher than that of prediction model M3, and the root mean square error is also reduced by 0.142. Comparing Figures 7 and 8, it can be seen that the prediction model M3-PCA(90) has a large fluctuation in the loss error, and the model prediction effect is not stable. It can be seen that the prediction effect of the stock price prediction model constructed by the LSTM deep neural network can be improved after performing principal component analysis on the input features with higher data dimensionality and a strong correlation between the data. In contrast, the coefficient of determination of M3-PCA(90) has decreased and the mean square error has increased, so when too much information is kept in the principal component analysis stock data, it will reduce the prediction effect of the stock price prediction model.Table 4
Table of stock price forecasts processed by principal components of stock trading technical indicators.
Stock forecasting modelInput feature dimensionInput feature selectionRMSER2M338Transaction basic indicators and transaction technical indicators0.8988.1%M3-PCA(80)11Retain 80% of feature information0.75491.2%M3-PCA(90)15Retain 90% of feature information0.87490.0%Figure 7
Training effect of model M3-PCA(80).Figure 8
Training effect of model M3-PCA(90).


## 5.3. Experimental Analysis of Stock Time Series Length Selection

In the LSTM neural network to construct stock prediction models, the length of the time series is one of the factors that affect the prediction effect of the stock prediction model. According to the experimental results in the first two sections, the trading index data after principal component analysis are selected as input variables, and the data are processed into time series of lengths 5, 10, 20, and 30, respectively, to build the model for training, and the prediction results are shown in Table5.Table 5
Results for the effect of time series length on stock price models.
Prediction modelSequence lengthRMSER2M3-PCA(80)-d550.89288.3%M3-PCA(80)-d10100.75891.2%M3-PCA(80)-d20200.76190.8%M3-PCA(80)-d30300.77290.1%As can be seen from Table5, the coefficient of determination of the prediction models with sequence lengths of 20 and 30 decreases compared with those of the other prediction models, while the model with a sequence length of 10 has the best prediction effect. This indicates that when the time series length is short, the forecasting model does not learn enough useful information from the stock data samples; when the time series length is long, the forecasting model learns too much information from the training samples and may learn some noisy information into the forecasting model as well, causing the forecasting model to become less effective.


## 6. Conclusions

This paper first describes stock trading technical indicators and uses principal component analysis to process the data of stock trading technical indicators by analyzing the characteristics of stock trading technical indicators. The basic stock trading data and the processed stock trading technical indicators data are combined and used as the input data for the prediction model. The LSTM deep neural network is selected to construct the stock price prediction model so as to predict the stock price. A detailed experimental demonstration is conducted to analyze the input features, time series length, and network structure that affect the effectiveness of the stock prediction model so that a stock price prediction model can be trained to adapt to the stock market with a good prediction effect. This provides an accurate stock price prediction model for the intelligent prediction module of the stock intelligent prediction system.



---

*Source: 8077277-2022-08-18.xml*