Stock price trend prediction method based on Chan-Stacked LSTM-DT model
By adopting the Chan-StackedLSTM-DT model in stock price trend prediction, combined with Chan Theory technical analysis and deep learning model, the problem of inaccurate stock price trend prediction in the existing technology is solved, and a more efficient and accurate stock price trend prediction effect is achieved.
Patent Information
- Application Number
- CN202411882698.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-11
AI Technical Summary
It is difficult for existing technology to accurately predict stock price trends, especially when stock prices are affected by multiple factors such as policies and emergencies. Traditional technical analysis methods and deep learning models do not predict well in some cases.
The stock price trend prediction method based on the Chan-StackedLSTM-DT model is adopted, and the stock price trend prediction is achieved by obtaining stock k-line data, combining the Chan Theory technical analysis method, and using the StackedLSTM model to predict trend growth, and combining the decision tree model to find inflection point signals to achieve more accurate stock price trend prediction.
Improve the accuracy and effectiveness of stock price trend forecasts, especially in stock price A-type trends, which can better avoid returns retracement and provide smarter investment decision support.
Smart Images

Figure CN119809831A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of price prediction, and in particular to a stock price trend prediction method based on a Chan-Stacked LSTM-DT model. Background Art
[0002] Stock price trend prediction has always been a difficult problem in the financial field. For investors, accurately predicting the trend changes of stock prices can help them make more informed investment decisions. In traditional technical analysis methods, Chaos Theory is an important tool. It is based on the idea of complete classification. By observing and classifying stock price trends, the current stock price position can be obtained in real time. The deep learning model can extract features by learning a large amount of data, obtain trend reversal signals and predict future trends. Therefore, combining the Chaos Theory technical analysis method with the deep learning model has a good effect on stock price trend prediction. Summary of the invention
[0003] The purpose of the present invention is to provide a stock price trend prediction method based on a Chan-Stacked LSTM-DT model to solve the problems raised in the above background technology.
[0004] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0005] A stock price trend prediction method based on Chan-StackedLSTM-DT model, the method comprising:
[0006] Step 1: Get the stock K-line data, process the K-line data into line segments based on the Chaos Theory technical analysis method, and define a line segment as a trend;
[0007] Step 2: Based on a novel stock information fusion method, stock information fusion is performed. Based on the morphological characteristics of the trend, other features within a trend are integrated into the morphological characteristics in time sequence to construct a complete trend feature.
[0008] Step 3: Use "a trend increase prediction method based on StackedLSTM" to predict the amplitude of the current line segment, and use "a turning point prediction method based on decision tree" to find the turning point signal;
[0009] Step 4. In the process of using "a trend increase prediction method based on StackedLSTM" to predict the amplitude of the current line segment and using "a turning point prediction method based on decision tree" to find the turning point signal, if the stock price goes down and falls through the previous turning point price in an upward trend, or when the stock price goes up and breaks through the previous turning point price in a downward trend, it means that the previous turning point prediction failed, and re-predict according to steps 1 to 3.
[0010] Preferably, step 1 comprises:
[0011] Get the stock K-line data, and then process the inclusion relationship, divide the top and bottom patterns, and construct strict pens;
[0012] The de-inclusion relation processing is used to process K-line data so as to better perform technical analysis, wherein the inclusion relation represents a situation where the highest price and the lowest price of two K-lines overlap each other;
[0013] The top and bottom classification is used to classify the K-line data into top classification and bottom classification;
[0014] The construction of strict pen means strictly constructing line segments based on characteristic sequences, which is realized based on "a method for selecting the starting point of the Chan theory pen";
[0015] The line segment represents a trend; the time span of the trend Trend time 、Initial Price Trend startPrice , End Price Trend endPrice The morphological characteristics that constitute a trendTrend morphology ;
[0016] At the same time, the amplitude of a trend Trend scope for:
[0017] Trend scope =|Trend startPrice -Trend endPrice |.
[0018] Preferably, a method for selecting the starting point of a entanglement pen includes:
[0019] After obtaining the K-line data, discard the first top and bottom pattern and use the second top and bottom pattern as the starting point for pen construction; this can avoid the situation where the first top and bottom pattern is inconsistent with the actual situation due to incomplete time series data obtained.
[0020] Preferably, other features within a trend in step 2 include: trend indicators, volume and price indicators, moving average system, real-time stock popularity data and real-time stockholder sentiment data;
[0021] The trend indicator Trend trendIndicators Including MACD, DMA, and MTM;
[0022] The volume price index Trend VolumePrice Including the volume accumulation line OBV and the simple volatility indicator EMV;
[0023] The Moving Average System TrendMA Including MA5, MA10, MA20, MA30, MA60, MA120, MA250;
[0024] Real-time popularity data Trend of the stocks mentioned Real-time-popularity Includes the search frequency of each stock in brokerage software and the search frequency of stocks in search engines;
[0025] The real-time sentiment data of stockholders Trend Real-time-emotional Including the impact of company news on each stock and the long and short market data of brokerage software.
[0026] Preferably, step 2 comprises:
[0027] Get the morphological characteristics of a trend Trend morphology , then the trend is characterized by the shape of the trend morphology Based on this, other features within a trend are integrated into the morphological features in time sequence to construct a complete trend feature Trend whole ;
[0028] Among other characteristics, the trend indicator Trend trendIndicators For reference:
[0029] Set the trend indicator Trend of the i-th trend trendIndicators (i) By MACD (i) DMA (i) 、MTM (i) constitute;
[0030] MACD (i) ={MACD 1 (i) ,MACD 2 (i) ,…,MACD n (i)};
[0031] Where n represents the number of K-lines in the i-th trend pattern, and K-lines are the unit of measurement within the trend;
[0032] Similarly, DMA (i) ={DMA 1 (i) ,DMA 2 (i) ,…,DMA n (i)}, MTM (i) ={MTM 1 (i) ,MTM 2 (i) ,…,MTM n(i)}; then we get Trend trendIndicators (i) ={MACD (i) ,DMA (i) ,MTM (i)};
[0033] Based on this, we get the volume price indicator Trend VolumePrice (i) =OBV (i) ,EMV (i)};
[0034] Among them, OBV (i) =OBV 1 (i) ,OBV 2 (i) ,…,OBV n (i)}, EMV (i) ={EMV 1 (i) ,EMV 2 (i) ,…,EMV n (i)};
[0035] Moving average system Trend MA (i) ={MA5 (i) ,MA10 (i) ,MA20 (i) ,MA30 (i) ,MA60 (i) ,MA120 (i) ,MA250 (i)};
[0036] Real-time stock popularity data Trend Real-time-popularity (i) = {Real-time-popularity 1 (i) ,Real-time-popularity 2 (i) ,…,Real-time-popularity n (i)};
[0037] Real-time sentiment data of stock investors Trend Real-time-emotional (i) ={Real-time-emotional 1 (i) ,Real-time-emotional2 (i) ,…,Real-time-emotional n (i)};
[0038] Correspondingly, a complete trend feature Trend whole (i) =
[0039] {Trend morphology (i) ,Trend VolumePrice (i) ,Trend MA (i) ,Trend Real-time-popularity (i) ,Trend Real-time-emotional (i)}.
[0040] Preferably, step 3 comprises:
[0041] After constructing the historical stock price trend and the complete characteristics of each trend based on the historical stock price trend, each stock is in an unfinished line segment. (n) = {Trend (1) ,Trend (2) ,…,Trend (n)}; Use "A trend increase prediction method based on StackedLSTM" to predict the amplitude Trend of the current segment scope (n+1) ;
[0042] Where n represents the number of existing line segments, Trend (i) represents the i-th paragraph;
[0043] If the stock price is currently in the predicted range Trend scope (n+1) The range of Trend scopeInterval (n+1) In the case of a stock, a "decision tree-based inflection point prediction method" is used to dynamically track the stock price; when an upward inflection point signal appears, it indicates a bullish trend, and when a downward inflection point signal appears, it indicates a bearish trend.
[0044] Among them, the interval range Trend scopeInterval (n+1) By the predicted amplitude Trend scope (n+1) and Trend (n) End price Trend endPrice (n)Determine and obtain the interval range Trend simultaneously scopeInterval (n+1) The algorithm is as follows:
[0045] If Trend endPrice (n) >Trend startPrice (n) then Trend scopeInterval (n+1) =[Trend endPrice (n) -Trend scope (n+1) *(1 + t), Trend endPrice (n) -Trend scope (n+1) *(1 - t)];
[0046] If Trend endPrice (n) <Trend startPrice (n) then Trend scopeInterval (n+1) =[Trend endPrice (n) +Trend scope (n+1) *(1 - t), Trend endPrice (n) +Trend scope (n+1) *(1 + t)];
[0047] Among them, t represents the threshold, which is determined by the characteristics of the intervening varieties.
[0048] Preferably, use "A Trend Rise Prediction Method Based on StackedLSTM" to predict the amplitude Trend scope (n+1) of the current line segment, including:
[0049] Obtain each trend feature Trend whole (i) and perform Embedding operation to obtain vectors Embedding (i) respectively, where 0 < i < n, and n represents the number of existing line segments;
[0050] Input the vector Embedding (i) as input data into the double-layer long short-term memory network StackedLSTM model, where the short-term LSTM focuses on the last 5 time steps, and the long-term LSTM uses the output of the short-term LSTM to update its state and output, capturing longer-term dependencies;
[0051] The output data of the double-layer long short-term memory network StackedLSTM is used as the predicted amplitude Trend of the n+1th segment scope (n+1) .
[0052] Preferably, the stock price is dynamically tracked using "a decision tree-based inflection point prediction method", including:
[0053] If we are currently in the nth trend, then we will set the trend indicator Trend trendIndicators (n) 、Volume Price Index Trend VolumePrice (n) , Moving Average System Trend MA (n) 、Real-time stock popularity data Trend Real-time-popularity (n) and real-time sentiment data of stockholders Trend Real-time-emotional (n) Enter the decision tree DT model as input data;
[0054] The output data of the decision tree DT model is used as the input data of the softmax activation function. The output result of the softmax activation function is used to determine whether a trend end signal appears: if Trend endPrice (n) >Trend startPrice (n) , then the nth bullish trend end signal is triggered, and the bearish trend will follow; if Trend endPrice (n) <Trend startPrice (n) , then the end signal of the nth short trend is triggered, and the bull trend will begin next.
[0055] Preferably, the short-term LSTM focuses on the most recent 5 time steps, and the long-term LSTM uses the output of the short-term LSTM, including:
[0056] The short-term LSTM is responsible for processing the input of the last 5 time steps, which can be recorded as x t-4 、x t-3 、x t-2 、x t-1 、x t , the output is h t ;
[0057] The long-term LSTM receives the output h from the short-term LSTM t , processes the hidden state of the entire sequence;
[0058] In the overall architecture, the output of the short-term LSTM is passed to the long-term LSTM to form a complete two-layer long short-term memory network StackedLSTM calculation process. This structure combines the advantages of short-term and long-term memory and can effectively process complex stock price time series data.
[0059] A computer-readable storage medium having a computer program stored thereon, characterized in that: when the program is executed by a processor, the steps in the above-mentioned stock price trend prediction method based on the Chan-StackedLSTM-DT model are implemented;
[0060] A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the computer program is executed based on
[0061] Steps in the stock price trend prediction method of the Chan-StackedLSTM-DT model.
[0062] Compared with the prior art, the beneficial effects achieved by the present invention are:
[0063] (1) In view of the fact that stock prices are affected by multiple factors such as policies and emergencies, and are flexible, changeable and difficult to predict, the present invention proposes a method for predicting stock price trends, which combines traditional technical analysis methods with artificial intelligence and uses a method that combines trend prediction with price prediction to predict inflection points.
[0064] (2) In view of the problem of unclear trend definition in existing stock price trend prediction, the present invention strictly gives the definition of trend, and innovatively proposes a new method of trend prediction based on this. In addition, a novel stock information fusion method is proposed, which takes the morphological characteristics of the trend as the basis, integrates other characteristics within a trend (trend indicators, volume and price indicators, moving average system, real-time stock popularity data, real-time stock investor sentiment data) into the morphological characteristics in time series, constructs a complete trend feature, and can achieve better prediction effect in trend prediction.
[0065] (3) Based on the actual stock price trend prediction background, a two-layer long short-term memory network StackedLSTM is designed. This structure combines the advantages of short-term and long-term memory and can effectively process complex stock price time series data.
[0066] (4) In response to the problem that "the technical analysis method of the Chaos Theory cannot grasp the turning point in the A-type trend of stock prices", the present invention uses a deep learning model to predict the amplitude of the trend. When the current stock price is within the range of the predicted amplitude and an inflection point signal appears, corresponding operations are performed to avoid a large profit drawdown caused by the A-type trend of the stock price.
[0067] (5) Based on the Chaos Theory of Technical Analysis, a "Chan Theory of Technical Analysis Starting Point Selection Method" was proposed, which can select the appropriate technical analysis starting point in any stock price trend.
[0068] (6) This patent innovatively provides a clear definition of “trend”, that is, one line segment is one trend, thus solving the problem of unclear concept of trend. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0070] Figure 1 It is a flow chart of a stock price trend prediction method based on Chan-StackedLSTM-DT model of the present invention;
[0071] Figure 2 It is a model architecture diagram of a stock price trend prediction method based on a Chan-StackedLSTM-DT model described in the present invention;
[0072] Figure 3 It is the K-line data chart processed by the Chaos Theory technical analysis method described in the present invention;
[0073] Figure 4 It is a prediction result diagram of the inflection point prediction method based on a decision tree described in the present invention. DETAILED DESCRIPTION
[0074] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0075] See also Figure 1-Figure 4 , the present invention provides a technical solution:
[0076] Embodiment 1:
[0077] A stock price trend prediction method based on Chan-StackedLSTM-DT model, the method comprising:
[0078] Step 1: Get the stock K-line data, process the K-line data into line segments based on the Chaos Theory technical analysis method, and define a line segment as a trend;
[0079] Preferably, Figure 1 As shown, step 1 includes:
[0080] Get the stock K-line data, and then process the inclusion relationship, divide the top and bottom patterns, and construct strict pens;
[0081] The removal of the inclusion relationship processing is used to process the K-line data in order to better perform technical analysis, wherein the inclusion relationship indicates that the highest price and the lowest price of two K-lines overlap each other. Processing the inclusion relationship can help simplify the analysis process and standardize and quantify the trend;
[0082] The steps for removing the inclusion relationship are as follows:
[0083] 1) Take the highest price and the lowest price: only take the highest price and the lowest price of the K-line, ignoring other information;
[0084] 2) Determine the relationship between the K-line positions: Determine whether there is an inclusion relationship based on the relationship between the highest and lowest prices of the two K-lines before and after;
[0085] 3) Processing of inclusion relationship: According to the position relationship between the K-line and the previous K-line, decide whether to use the "high-high" or "low-low" processing method. If the position of the K-line in the inclusion relationship rises, the "high-high" processing method is adopted; if the position falls, the "low-low" processing method is adopted;
[0086] The top and bottom classification is used to classify the K-line data into top classification and bottom classification;
[0087] The construction of strict pen means strictly constructing line segments based on characteristic sequences, which is realized based on "a method for selecting the starting point of the Chan theory pen";
[0088] The line segment represents a trend; the time span of the trend Trend time 、Initial Price Trend startPrice , End Price Trend endPrice The morphological characteristics that constitute a trendTrend morphology ;
[0089] At the same time, the amplitude of a trend Trend scope for:
[0090] Trend scope =|Trend startPrice -Tr endendPrice |.
[0091] Preferably, a method for selecting the starting point of a entanglement pen includes:
[0092] After obtaining the K-line data, discard the first top and bottom pattern and use the second top and bottom pattern as the starting point for pen construction; this can avoid the situation where the first top and bottom pattern is inconsistent with the actual situation due to incomplete time series data obtained.
[0093] Preferably, other features within a trend in step 2 include: trend indicators, volume and price indicators, moving average system, real-time stock popularity data and real-time stockholder sentiment data;
[0094] The trend indicator Trend trendIndicators Including MACD, DMA, and MTM;
[0095] The volume price index Trend VolumePrice Including the volume accumulation line OBV and the simple volatility indicator EMV;
[0096] The Moving Average System Trend MA Including MA5, MA10, MA20, MA30, MA60, MA120, MA250;
[0097] Real-time popularity data Trend of the stocks mentioned Real-time-popularity Includes the search frequency of each stock in brokerage software and the search frequency of stocks in search engines;
[0098] The real-time sentiment data of stockholders Trend Real-time-emotional Including the impact of company news on each stock and the long and short market data of brokerage software.
[0099] Step 2: Based on a novel stock information fusion method, stock information fusion is performed. Based on the morphological characteristics of the trend, other features within a trend are integrated into the morphological characteristics in time sequence to construct a complete trend feature.
[0100] Preferably, step 2 comprises:
[0101] Get the morphological characteristics of a trend Trend morphology , then the trend is characterized by the shape of the trend morphology Based on this, other features within a trend are integrated into the morphological features in time sequence to construct a complete trend feature Trend whole ;
[0102] Among other characteristics, the trend indicator Trend trendIndicators For reference:
[0103] Set the trend indicator Trend of the i-th trend trendIndicators (i) By MACD (i) DMA (i) 、MTM (i) constitute;
[0104] MACD (i) ={MACD 1(i) ,MACD 2 (i) ,…,MACD n (i)};
[0105] Where n represents the number of K-lines in the i-th trend pattern, and K-lines are the unit of measurement within the trend;
[0106] Similarly, DMA (i) ={DMA 1 (i) ,DMA 2 (i) ,…,DMA n (i)}, MTM (i) ={MTM 1 (i) ,MTM 2 (i) ,…,MTM n (i)}; then we get Trend trendIndicators (i) ={MACD (i) ,DMA (i) ,MTM (i)};
[0107] Based on this, we get the volume price indicator Trend VolumePrice (i) =OBV (i) ,EMV (i)};
[0108] Among them, OBV (i) =OBV 1 (i) ,OBV 2 (i) ,…,OBV n (i)}, EMV (i) ={EMV 1 (i) ,EMV 2 (i) ,…,EMV n (i)};
[0109] Moving average system Trend MA (i) ={MA5 (i) ,MA10 (i) ,MA20 (i) ,MA30 (i) ,MA60 (i) ,MA120 (i),MA250 (i)};
[0110] Real-time stock popularity data Trend Real-time-popularity (i) = {Real-time-popularity 1 (i) ,Real-time-popularity 2 (i) ,…,Real-time-popularity n (i)};
[0111] Real-time sentiment data of stock investors Trend Real-time-emotional (i) ={Real-time-emotional 1 (i) ,Real-time-emotional 2 (i) ,…,Real-time-emotional n (i)};
[0112] Correspondingly, a complete trend feature Trend whole (i) = {Trend morphology (i) ,Trend VolumePrice (i) ,Trend MA (i) ,Trend Real-time-popularity (i) ,Trend Real-time-emotional (i)}.
[0113] Step 3: Use "a trend increase prediction method based on StackedLSTM" to predict the amplitude of the current line segment, and use "a turning point prediction method based on decision tree" to find the turning point signal;
[0114] Preferably, step 3 comprises:
[0115] After constructing the historical stock price trend and the complete characteristics of each trend based on the historical stock price trend, each stock is in an unfinished line segment. (n) = {Trend (1) ,Trend (2) ,…,Trend (n)}; Use "A trend increase prediction method based on StackedLSTM" to predict the amplitude Trend of the current segment scope (n+1) ;
[0116] Where n represents the number of existing segments, Trend (i) represents the i-th paragraph;
[0117] If the stock price is currently in the predicted range Trend scope (n+1) The range of Trend scopeInterval (n+1) In the case of a stock, a "decision tree-based inflection point prediction method" is used to dynamically track the stock price; when an upward inflection point signal appears, it indicates a bullish trend, and when a downward inflection point signal appears, it indicates a bearish trend.
[0118] Among them, the interval range Trend scopeInterval (n+1) By the predicted amplitude Trend scope (n+1) and Trend (n) End price Trend endPrice (n) Determine and get the interval range Trend scopeInterval (n+1) The algorithm is as follows:
[0119] If Trend endPrice (n) >Trend startPrice (n) , then Trend scopeInterval (n+1) =Trend endPrice (n) -Trend scope (n+1) *(1+t),Trend endPrice (n) -Trend scope (n+1) *(1-t)];
[0120] If Trend endPrice (n) <Trend startPrice (n) , then Trend scopeInterval (n+1) =Trend endPrice (n) +Trend scope (n+1) *(1-t),Trend endPrice(n) +Trend scope (n+1) *(1 + t)];
[0121] Wherein, t represents the threshold value, which is determined by the characteristics of the involved varieties.
[0122] Preferably, in step 3, the "Trend increase prediction method based on Stacked LSTM" is used to predict the amplitude Trend of the current line segment scope (n+1) , including:
[0123] Obtain each trend feature Trend whole (i) , and perform Embedding operation to obtain vectors Embedding (i) , where 0 < i < n, and n represents the number of existing line segments;
[0124] Take the vector Embedding (i) as input data and input it into the double-layer long short-term memory network Stacked LSTM model. Among them, the short-term LSTM focuses on the last 5 time steps, and the long-term LSTM uses the output of the short-term LSTM to update its state and output, capturing longer-term dependencies;
[0125] Then take the output data of the double-layer long short-term memory network Stacked LSTM as the predicted amplitude Trend of the (n + 1)-th segment scope (n+1) .
[0126] Preferably, the short-term LSTM focuses on the last 5 time steps, and the long-term LSTM uses the output of the short-term LSTM, including:
[0127] The short-term LSTM is responsible for processing the input of the last 5 time steps, which can be denoted as x t-4 、x t-3 、x t-2 、x t-1 、x t , and the output is h t ; For each time step t, the calculation formula of the short-term LSTM is as follows:
[0128] Forget gate f t : f t = σ(w f *[h t-1 , x t +b f );
[0129] Input gate i t : i t = σ(w i*[h t-1 ,x t ]+b i );
[0130] Memory Information C t :C t =f t *C t-1 +i t *tanh(w c *[h t-1 ,x t ]+b c );
[0131] Output gate o t :o t =σ(w o *[h t-1 ,x t ]+b o );
[0132] The output h of the short-term LSTM t h t =o t *tanh(C t );
[0133] The long-term LSTM receives the output h from the short-term LSTM t , processing the hidden state of the entire sequence; for each step length t, the long-term LSTM calculation formula is as follows:
[0134] Forgotten Gate t :f' t =σ(w' f *[h' t-1 ,x t ]+b' f );
[0135] Input gate i' t :i' t =σ(w' i *[h' t-1 ,x t ]+b' i );
[0136] Memory information C' t : C' t =f' t *C' t-1 +i' t *tanh(w' c *[h' t-1 ,x t ]+b' c );
[0137] Output gate o' t :o' t =σ(w' o *[h' t-1 ,h t ]+b' o );
[0138] The output h' of the short-term LSTM t h' t =o' t *tanh(C' t );
[0139] In the overall architecture, the output of the short-term LSTM is passed to the long-term LSTM to form a complete two-layer long short-term memory network StackedLSTM calculation process. This structure combines the advantages of short-term and long-term memory and can effectively process complex stock price time series data.
[0140] Preferably, in step 3, dynamically tracking the stock price using "a decision tree-based inflection point prediction method" includes:
[0141] If we are currently in the nth trend, then we will set the trend indicator Trend trendIndicators (n) 、Volume Price Index Trend VolumePrice (n) , Moving Average System Trend MA (n) 、Real-time stock popularity data Trend Real-time-popularity (n) and real-time sentiment data of stockholders Trend Real-time-emotional (n) Enter the decision tree DT model as input data;
[0142] The output data of the decision tree DT model is used as the input data of the softmax activation function. The output result of the softmax activation function is used to determine whether a trend end signal appears: if Trend endPrice (n) >Trend startPrice (n) , then the nth bullish trend end signal is triggered, and the bearish trend will follow; if Trend endPrice (n) <Trend startPrice (n) , then the end signal of the nth short trend is triggered, and the bull trend will begin next.
[0143] Step 4: In the process of predicting the amplitude of the current line segment using "a trend increase prediction method based on StackedLSTM" and finding the inflection point signal using "a inflection point prediction method based on decision tree", if the stock price goes down and falls through the previous inflection point price in an upward trend, or if the stock price goes up and breaks through the previous inflection point price in a downward trend, it means that the previous inflection point prediction failed, and re-predict according to steps 1 to 3;
[0144] Preferably, step 4 comprises:
[0145] Assuming that it has entered a bullish trend, the trend is (n+1) It has been completed. At this time, the stock price is in an unfinished line segment Trend (n+2) In the example, based on the existing line segment sequence Trend (n+1) = {Trend (1) ,Trend (2) ,…,Trend (n+1)}, use "A trend increase prediction method based on StackedLSTM" to predict the amplitude Trend of the current segment scope (n+2) ;
[0146] If the stock price is currently in the predicted range Trend scope (n+2) The range of Trend scopeInterval (n+2) In the future, the stock price is dynamically tracked using "a turning point prediction method based on decision tree". When a turning point signal appears in a downward direction, it means that a short trend has entered. After judging that a long trend has entered, if the stock price goes down and falls below the predicted range Trend scope (n+1) The range of Trend scopeInterval (n+1) , it means that the prediction failed and the stock price is still in the trend. (n+1) In the above example, re-predictions are made based on steps 1 to 3.
[0147] The present invention is not only applicable to the field of stock prediction, but also has effects on the field of price series prediction and time series data prediction which can be represented by K-line charts.
[0148] like Figure 3 As shown, Figure 3 This is the K-line data chart processed based on the technical analysis method of Chaos Theory. The blue line represents the pen and the red line represents the line segment.
[0149] like Figure 4 As shown, Figure 4This is the prediction result diagram of the inflection point prediction method based on decision tree. Through comparative experiments on four different algorithms, the experimental results show that the inflection point prediction method based on decision tree has good test indicators in terms of accuracy, recall rate, precision, F1 value, and cumulative rate of return.
[0150] Embodiment 2:
[0151] The computer-readable storage medium of this embodiment stores a computer program thereon, and when the program is executed by the processor, the steps in the stock price trend prediction method based on the Chan-Stacked LSTM-DT model of Example 1 are implemented.
[0152] The computer-readable storage medium of this embodiment may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal; the computer-readable storage medium of this embodiment may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, etc. equipped on the terminal; further, the computer-readable storage medium may also include both an internal storage unit of the terminal and an external storage device.
[0153] The computer-readable storage medium of this embodiment is used to store computer programs and other programs and data required by the terminal. The computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
[0154] Embodiment 3:
[0155] The computer device of this embodiment includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, a method based on Embodiment 1 is implemented.
[0156] Steps in the stock price trend prediction method of the Chan-StackedLSTM-DT model.
[0157] In this embodiment, the processor may be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, readily available programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0158] Those skilled in the art will appreciate that the disclosed content of the embodiments may be provided as methods, systems, or computer program products. Therefore, the present solution may adopt the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Moreover, the present solution may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program codes.
[0159] The present solution is described with reference to the method according to the embodiment of the present solution and the flowchart and / or block diagram of the computer program product. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions; these computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 one or more processes and / or methods Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0160] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 one or more processes and / or methods Figure 1 A function specified in one or more boxes.
[0161] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 one or more processes and / or methods Figure 1 The steps for the functions specified in one or more boxes.
[0162] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0163] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A stock price trend prediction method based on Chan-StackedLSTM-DT model, characterized by: The method comprises: Step 1: Get the stock K-line data, process the K-line data into line segments based on the Chaos Theory technical analysis method, and define a line segment as a trend; Step 2: Based on a novel stock information fusion method, stock information fusion is performed. Based on the morphological characteristics of the trend, other features within a trend are integrated into the morphological characteristics in time sequence to construct a complete trend feature. Step 3: Use "a trend increase prediction method based on StackedLSTM" to predict the amplitude of the current line segment, and use "a turning point prediction method based on decision tree" to find the turning point signal; Step 4. In the process of using "a trend increase prediction method based on StackedLSTM" to predict the amplitude of the current line segment and using "a turning point prediction method based on decision tree" to find the turning point signal, if the stock price goes down and falls through the previous turning point price in an upward trend, or when the stock price goes up and breaks through the previous turning point price in a downward trend, it means that the previous turning point prediction failed, and re-predict according to steps 1 to 3.
2. A stock price trend prediction method based on Chan-StackedLSTM-DT model as claimed in claim 1, characterized in that: The step 1 comprises: Get the stock K-line data, and then process the inclusion relationship, divide the top and bottom patterns, and construct strict pens; The de-inclusion relation processing is used to process K-line data so as to better perform technical analysis, wherein the inclusion relation represents a situation where the highest price and the lowest price of two K-lines overlap each other; The top and bottom classification is used to classify the K-line data into top classification and bottom classification; The construction of strict pen means strictly constructing line segments based on characteristic sequences, which is realized based on "a method for selecting the starting point of a entanglement pen"; The line segment represents a trend; the time span of the trend Trend is Trend time 、Initial Price Trend startOrice , End Price Trend endPrice The morphological characteristics that constitute a trendTrend morphology ; At the same time, the amplitude of a trend Trend scope for: trend scope =|Trend startPrice -Trends ndPrice |。 3. A stock price trend prediction method based on Chan-StackedLSTM-DT model as claimed in claim 2, characterized in that: The method for selecting the starting point of a entanglement pen comprises: After obtaining the K-line data, discard the first top and bottom pattern and use the second top and bottom pattern as the starting point for pen construction; this can avoid the situation where the first top and bottom pattern is inconsistent with the actual situation due to incomplete time series data obtained.
4. A stock price trend prediction method based on Chan-StackedLSTM-DT model as claimed in claim 1, characterized in that: Other features within a trend in step 2 include: trend indicators, volume and price indicators, moving average system, real-time stock popularity data, and real-time stockholder sentiment data; The trend indicator Trend trendIndicators Including MACD, DMA, and MTM; The volume price index Trend VolumePrice Including the volume accumulation line OBV and the simple volatility indicator EMV; The Moving Average System Trend MA Including MA5, MA10, MA20, MA30, MA60, MA120, MA250; Real-time popularity data Trend of the stocks mentioned Real-time-popularity Includes the search frequency of each stock in brokerage software and the search frequency of stocks in search engines; The real-time sentiment data of stockholders Trend Real-time-emotional Including the impact of company news on each stock and the long and short market data of brokerage software.
5. A stock price trend prediction method based on Chan-StackedLSTM-DT model as claimed in claim 1, characterized in that: The step 2 comprises: Get the morphological characteristics of a trend Trend morphology , then the trend is characterized by the shape of the trend morphology Based on this, other features within a trend are integrated into the morphological features in time sequence to construct a complete trend feature Trend whole ; Among other characteristics, the trend indicator Trend trendIndicators For reference: Set the trend indicator Trend of the i-th trend trendIndicators (i) By MACD (i) ,DMA (i) 、MTM (i) constitute; MACD (i) ={MACD1 (i) ,MACD2 (i) ,…,MACD n (i) }; Where n represents the number of K-lines in the i-th trend pattern, and K-lines are the unit of measurement within the trend; Similarly, DMA (i) ={DMA1 (i) ,DMA2 (i) ,…,DMA n (i) }, MTM (i) ={MTM1 (i) ,MTM2 (i) ,…,MTM n (i) }; then we get Trend trendIndicators (i) ={MACD (i) ,DMA (i) ,MTM (i) }; Based on this, we get the volume price indicator Trend VolumePrice (i) =OBV (i) ,EMV (i) }; Among them, OBV (i) =OBV1 (i) ,OBV2 (i) ,…,OBV n (i) }, EMV (i) ={EMV1 (i) ,EMV2 (i) ,…,EMV n (i) }; Moving average system Trend MA (i) ={MA5 (i) ,MA10 (i) ,MA20 (i) ,MA30 (i) ,MA60 (i) ,MA120 (i) ,MA250 (i) }; Real-time stock popularity data Trend Real-time-popularity (i) ={Real-time-popularity1 (i) ,Real-time-popularity2 (i) ,…,Real-time-popularity n (i) }; Real-time sentiment data of stockholders Trend Real-time-emotional (i) ={Real-time-emotional1 (i) ,Real-time-emotional2 (i) ,…,Real-time-emotional n (i) }; Correspondingly, a complete trend feature Trend whole (i) = {Trend morphology (i) ,Trend VolumePrice (i) ,Trend MA (i) ,Trend Real-time-popularity (i) ,Trend Real-time-emotional (i) }.
6. A stock price trend prediction method based on Chan-StackedLSTM-DT model as claimed in claim 1, characterized in that: The step 3 comprises: After constructing the historical stock price trend and the complete characteristics of each trend based on the historical stock price trend, each stock is in an unfinished line segment. (n) = {Trend (1) ,Trend (2) ,…,Trend (n) }; Use "A trend increase prediction method based on StackedLSTM" to predict the amplitude of the current line segment Trend scope (n+1) ; Where n represents the number of existing line segments, Trend (i) represents the i-th paragraph; If the stock price is currently in the predicted range Trend scope (n+1 ) interval range Trend scopeInterval (n+1) In the case of a stock, a "decision tree-based inflection point prediction method" is used to dynamically track the stock price; when an upward inflection point signal appears, it indicates a bullish trend, and when a downward inflection point signal appears, it indicates a bearish trend. Among them, the interval range Trend scopeInterval (n+1) By the predicted amplitude Trend scope (n+1) and Trend (n) End price Trend endPrice (n) Determine and get the interval range Trend scopeInterval (n+1) The algorithm is as follows: If Trend endPrice (n) >Trend startPrice (n) , then Trend scopeInterval (n+1) = [Tred endPrice (n) - Trend scope (n+1) * (1 + t), Trend endPrice (n) - Trend scope (n+1) * (1 - t)]; If Trend endPrice (n) <Trend startPrice (n) , then Trend scopeInterval (n+1) = [Tr entdndPrice (n) + Trend scope (n+1) * (1 - t), Trend endPrice (n) + Trend scope (n+1) * (1 + t)]; Among them, t represents the threshold value, which is determined by the characteristics of the intervention variety.
7. A stock price trend prediction method based on Chan-StackedLSTM-DT model as claimed in claim 6, characterized in that: The method of using "a trend increase prediction method based on StackedLSTM" to predict the amplitude of the current line segment Trend scope (n+1) ,include: Obtain each trend feature Trend whole (i) and perform an Embedding operation to obtain vectors Embedding respectively (i) where 0 < i < n and n represents the number of existing line segments; Embedding the vector (i) The input data is fed into a two-layer long short-term memory network StackedLSTM model, where the short-term LSTM focuses on the last five time steps, and the long-term LSTM uses the output of the short-term LSTM to update its state and output to capture longer-term dependencies. The output data of the double-layer long short-term memory network StackedLSTM is used as the predicted amplitude Trend of the n+1th segment scope (n +1) .
8. A stock price trend prediction method based on Chan-StackedLSTM-DT model as claimed in claim 6, characterized in that: The method of dynamically tracking stock prices by using "a decision tree-based inflection point prediction method" includes: If we are currently in the nth trend, then we will set the trend indicator Trend trendIndicators (n) 、Volume Price Index Trend VolumePrice (n) , Moving Average System Trend MA (n) 、Real-time stock popularity data Trend Real-time-popularity (n) and real-time sentiment data of stock investors Trend Real-time-emotional (n) Enter the decision tree DT model as input data; The output data of the decision tree DT model is used as the input data of the softmax activation function. The output result of the softmax activation function is used to determine whether a trend end signal appears: if Trend endPrice (n) >Trend startPrice (n) , then the nth bullish trend end signal is triggered, and the bearish trend will follow; if Trend endPrice (n) <Trend startPrice (n) , then the end signal of the nth short trend is triggered, and the bull trend will begin next.
9. A method for predicting stock price trends based on a Chan-StackedLSTM-DT model as claimed in claim 7, characterized in that: The short-term LSTM focuses on the most recent 5 time steps, and the long-term LSTM uses the output of the short-term LSTM, including: The short-term LSTM is responsible for processing the input of the last 5 time steps, which can be recorded as x t-4 、x t-3 、x t-2 、x t-1 、x t , the output is h t ; The long-term LSTM receives the output h from the short-term LSTM t , processes the hidden state of the entire sequence; In the overall architecture, the output of the short-term LSTM is passed to the long-term LSTM to form a complete two-layer long short-term memory network StackedLSTM calculation process. This structure combines the advantages of short-term and long-term memory and can effectively process complex stock price time series data.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps in a stock price trend prediction method based on a Chan-StackedLSTM-DT model as described in any one of claims 1 to 9 are implemented; A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in a stock price trend prediction method based on the Chan-Stacked LSTM-DT model as described in any one of claims 1 to 9 are implemented.
Citation Information
Cited By
Machine learning-based multi-output regression incremental learning dynamic adaptation stock price prediction model construction method
CN121413805A