Stock price prediction using machine learning has emerged as a critical area of research due to its potential to provide valuable insights into financial markets and support informed investment decisions. The inherent complexity, unpredictability, and volatility of stock prices make traditional forecasting models less effective in delivering accurate predictions. Consequently, there has been growing interest in applying advanced machine learning techniques to improve the precision and reliability of stock price forecasts.This research introduces a hybrid model approach that combines Bidirectional Long Short-Term Memory (BiLSTM) networks with an enhanced Transformer model. The BiLSTMeffetively captures sequential dependencies in time-series data, while the enhanced Transformer improves the model’s focus on relevant features and time steps, boosting prediction accuracy.
However, existing models fail to adequately capture complex temporal dependencies and lack the integration of key features such as historical prices, market sentiment, and macroeconomic indicators, which leads to prediction inaccuracies. To address these limitations, our proposed model employs BiLSTM to capture bidirectional temporal dependencies, an enhanced Transformer to model complex feature interactions via self-attention mechanisms, and a Temporal Convolutional Network (TCN) to efficiently manage long sequences using causal convolutions. By processing each data source through its respective model and concatenating the outputs, this hybrid architecture captures both short-term and long-term dependencies, offering improved stock price prediction performance. A web-based interface provides real-time visualization of predictions, trends, model accuracy, and candlestick charts with technical indicators. Testing results demonstrate high predictive accuracy ranging between 85% and 95%, validating the robustness of the hybrid model. This work highlights the effectiveness of combining multiple machine learning paradigms in financial forecasting.
Introduction
Stock price prediction is crucial for financial decision-making but is challenging due to the volatile, non-linear, and complex nature of markets. Traditional statistical methods often fail to capture these complexities, leading to growing interest in deep learning techniques. The paper proposes a hybrid deep learning model combining Bidirectional Long Short-Term Memory (BiLSTM), Transformer networks, and Temporal Convolutional Networks (TCN) to leverage their strengths in capturing sequential dependencies, attention-based feature extraction, and efficient local trend modeling.
This hybrid model also incorporates Donchian Channels for enhanced trend analysis and is evaluated on real-world data, showing improved accuracy (85%-95%) and interpretability over single models. The system includes a user-friendly interface displaying predictions, trends, and accuracy metrics, offering actionable insights for investors.
The paper also reviews existing literature on various models integrating sentiment analysis, ensemble learning, and technical indicators. The proposed architecture uses data preprocessing, feature engineering, and ensemble learning that combines LSTM, Random Forest, and XGBoost models, with decision fusion via a meta-model (linear regression) to optimize predictions. Sentiment analysis of financial news is included to capture market psychology.
Evaluation with metrics such as MAE, MSE, RMSE, and R² demonstrates that the ensemble model outperforms individual models, achieving higher accuracy and robustness, making it suitable for real-world dynamic stock market forecasting.
Conclusion
This project successfully demonstrates the potential of a hybrid deep learning model in forecasting short-term stock prices with high accuracy. By integrating BiLSTM, Transformer, and TCN architectures along with Donchian Channels, the system effectively captures both temporal dependencies and market trend signals. The model achieved promising predictive performance, supported by intuitive visualizations and a user-friendly web interface. Unlike traditional approaches, the hybrid structure offers improved learning stability, deeper insight into trends, and greater adaptability to market fluctuations. This work highlights the growing relevance of AI in financial forecasting and sets a foundation for future improvements such as incorporating real-time news sentiment, adaptive learning, and multi-stock portfolio prediction for enhanced decision-making.
Future enhancements to this system will focus on increasing prediction accuracy and expanding functionality. One key direction is the integration of real-time news sentiment analysis using Natural Language Processing (NLP) to capture external market influences. Incorporating additional technical indicators such as MACD, RSI, and Bollinger Bands will further strengthen the model’s analytical depth. The model will also be extended to support multi-stock portfolio prediction and longer forecasting windows. Additionally, plans include adaptive learning techniques to retrain models automatically based on recent data trends. For deployment, hosting the application on platforms like Render or AWS will allow real-time access to a wider audience. These improvements aim to enhance both the intelligence and usability of the system.
References
[1] Hochreiter, S., Schmidhuber, J. (1997). \"Long Short-Term Memory.\" Neural Computation.
[2] Breiman, L. (2001). \"Random Forests.\" Machine Learning.
[3] Chen, T., Guestrin, C. (2016). \"XGBoost: A Scalable Tree Boosting System.\" KDD.
[4] Pang, B., Lee, L. (2008). \"Opinion Mining and Sentiment Analysis.\" Foundations and Trends in Information Retrieval.
[5] Zhang, Y., et al. (2021). \"Ensemble Learning for Financial Market Prediction.\" IEEE Transactions on Neural Networks.
[6] Narayana Darapaneni, Anwesh Reddy Paduri, Himank Sharma, Milind Manjrekar, Nutan Hindlekar, Pranali Bhagat, Usha Aiyer, Yogesh Agarwal \" Stock Price Prediction using Sentiment Analysis and Deep Learning for Indian Markets.\"
[7] Harmanjeet Singh, Manisha Malhotra \" A Novel Approach of Stock Price Direction and Price Prediction Based on News Sentiments.\"
[8] Julius Tanuwijaya, Seng Hansun “Stock Index Prediction using k-Nearest Neighbors Regression.\"
[9] Aihua Li1, Qinyan Wei, Yong Shi and Zhidong Liu\" Research on stock price prediction from a data fusion perspective.\"
[10] Saleh Albahli, Aun Irtaza, Tahira Nazir, Awais Mehmood, Ali Alkhalifah and Waleed Albattah, “A MachineLearning Method for Prediction of Stock Market Using Real-Time Twitter Data.\"
[11] Xinhua Yuan, Jin Yuan, Tianzhao Jiang, and Qurat Ul Ain\" Integrated Long-Term Stock Selection Models Based on Feature Selection and Machine Learning Algorithms for China Stock Market.\"
[12] Rui Zhang and Vladimir Y. Mariano, \" Integration of Emotional Factors with GAN Algorithm in Stock Price Prediction Method Research.\"
[13] Bassant A. Abdelfattah, Saad M. Darwish and Saleh M. Elkaffas,\" Enhancing the Prediction of Stock Market Movement Using Neutrosophic-Logic-Based Sentiment Analysis.\"
[14] Chris Wang, Yilun Xu, Qingyang Wang, \" Novel Approaches to Sentiment Analysis for Stock Prediction.\"
[15] Ali Peivandizadeh, Sima Hatami, Amirhossein Nakhjavani, Lida Khoshsima, Mohammad Reza ChalakQazani, Muhammad Haleem, RoohallahAlizadehsani \" Stock market prediction with transductive long short-term memory and social media sentiment analysis.