[Paper Review] Stock Market Trend Analysis Using Hidden Markov Model and Long Short Term Memory
This paper proposes a hybrid model combining Hidden Markov Models (HMM) with Long Short-Term Memory (LSTM) networks for stock market trend prediction. It evaluates four variants—GMM-HMM, XGB-HMM, GMM-HMM+LSTM, and XGB-HMM+LSTM—using the triple barrier method for labeling trends and a score function to select features. The XGB-HMM+LSTM model achieved the highest test accuracy of 80.70%, demonstrating superior performance in predicting market direction.
This paper intends to apply the Hidden Markov Model into stock market and and make predictions. Moreover, four different methods of improvement, which are GMM-HMM, XGB-HMM, GMM-HMM+LSTM and XGB-HMM+LSTM, will be discussed later with the results of experiment respectively. After that we will analyze the pros and cons of different models. And finally, one of the best will be used into stock market for timing strategy.
Motivation & Objective
- To improve stock market trend prediction by integrating HMM with deep learning models such as LSTM.
- To evaluate and compare the performance of four hybrid models: GMM-HMM, XGB-HMM, GMM-HMM+LSTM, and XGB-HMM+LSTM.
- To develop a feature selection strategy using a score function based on accuracy, entropy, and state weight to identify the most informative market indicators.
- To apply the best-performing model to a real-world timing strategy using historical stock data from Fengyuan Pharmaceutical and Red Sun.
Proposed method
- The triple barrier method is used to label stock price movements: +1 if the upper profit-taking barrier is hit first, -1 if the lower stop-loss barrier is hit, and 0 if the time expiration barrier is reached.
- Eight feature types (market, quality, risk, value, mood, index, momentum, rise) are extracted and evaluated using a score function combining state accuracy, entropy, and state frequency.
- GMM-HMM and XGB-HMM models are trained separately on each feature type to generate state probability matrices (state_proba) for each time step.
- The state_proba matrices from all eight feature types are concatenated to form the input X for the LSTM model, which learns to map hidden states to future price direction labels.
- LSTM is trained on the concatenated state probabilities (X) and corresponding labels (Y), with the final output being a predicted trend direction.
- Model performance is evaluated using test set accuracy, with hyperparameters tuned to optimize generalization.
Experimental results
Research questions
- RQ1How does the integration of HMM with LSTM improve stock price trend prediction compared to standalone models?
- RQ2Which feature selection method—based on a composite score of accuracy, entropy, and state weight—yields the most predictive input for the LSTM?
- RQ3How do the performance metrics of GMM-HMM+LSTM and XGB-HMM+LSTM compare in terms of test accuracy on unseen data?
- RQ4Does the XGB-HMM model outperform GMM-HMM in capturing market regime transitions, and if so, why?
Key findings
- The XGB-HMM+LSTM model achieved the highest test accuracy of 80.699%, significantly outperforming the GMM-HMM+LSTM model, which achieved 76.161% accuracy.
- The XGB-HMM model demonstrated better generalization than GMM-HMM, with 87% test accuracy compared to GMM-HMM’s 83% on the training set.
- The score function effectively prioritized features such as log returns, volatility ratios, and price-to-book ratios, which contributed most to predictive power.
- LSTM outperformed XGBoost in fitting the state probability-to-label mapping, indicating its superior ability to model temporal dependencies in HMM state sequences.
- The triple barrier method successfully encoded directional price movements, enabling consistent labeling of trend events across different time horizons.
- The model architecture using XGB-HMM to extract latent states and LSTM to model their temporal evolution proved robust and effective for financial time series prediction.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.