The Science and Information (SAI) Organization publishes open-access peer-reviewed journals in computer science and artificial intelligence.

Contact Info
Website thesai.org
Follow Us
Contact Info
Follow Us
Research Article | Open Access |

Generating a Trading Strategy Using Candlestick Patterns with Machine Learning

Author 1: Hussaina Bala Malami Author 2: Badamasi Imam Ya’u Author 3: Fatima Umar Zambuk Author 4: Mohannad Alkanan Author 5: Osman Elwasila Author 6: Mohammad Shuaib Mir Author 7: Mohammed Nasir Danmalam Bawa Author 8: Yonis Gulzar
International Journal of Advanced Computer Science and Applications (IJACSA) · Vol. 16, No. 9 · Published 2025

DOI: https://doi.org/10.14569/IJACSA.2025.0160931

Abstract

This study examines the application of machine learning (ML) algorithms for multi-day stock price prediction on the Nigerian Stock Exchange (NSE) from 2013 to 2023, to inform trading strategies. Utilizing candlestick patterns and technical indicators, including Simple Moving Average (SMA), Exponential Moving Average (EMA), and Volume Rate of Change (VROC), as input features, the models were trained to capture historical price dynamics. Among the evaluated algorithms, Ridge Regression demonstrated superior performance, achieving a Mean Absolute Error (MAE) of 0.0366 over a three-day forecasting horizon, while effectively mitigating overfitting and handling market volatility. In contrast, Decision Tree, Lasso, Support Vector Regressor (SVR), and K-Nearest Neighbors (KNN) models exhibited limitations due to sensitivity to data noise and overfitting. A recursive multi-step forecasting approach further enhanced prediction accuracy by incorporating temporal dependencies. However, backtesting revealed that predictive accuracy alone did not guarantee profitable trading outcomes, emphasizing the need to integrate market conditions, risk management, and strategy design. The findings underscore the importance of robust feature engineering and data preprocessing in financial ML applications. While Ridge Regression shows promise for stock price forecasting, successful trading strategies require a holistic framework that accounts for broader market factors. Future research should explore hybrid modeling techniques and additional exogenous variables to improve robustness.

Keywords

How to Cite this Article

Hussaina Bala Malami, Badamasi Imam Ya’u, Fatima Umar Zambuk, Mohannad Alkanan, Osman Elwasila, Mohammad Shuaib Mir, Mohammed Nasir Danmalam Bawa and Yonis Gulzar. "Generating a Trading Strategy Using Candlestick Patterns with Machine Learning". International Journal of Advanced Computer Science and Applications (IJACSA), Vol. 16, No. 9, 2025. https://doi.org/10.14569/IJACSA.2025.0160931

BibTeX

@article{Malami2025,
  title     = {Generating a Trading Strategy Using Candlestick Patterns with Machine Learning},
  journal   = {International Journal of Advanced Computer Science and Applications},
  volume    = {16},
  number    = {9},
  year      = {2025},
  publisher = {The Science and Information Organization},
  author    = {Hussaina Bala Malami and Badamasi Imam Ya’u and Fatima Umar Zambuk and Mohannad Alkanan and Osman Elwasila and Mohammad Shuaib Mir and Mohammed Nasir Danmalam Bawa and Yonis Gulzar},
  doi       = {10.14569/IJACSA.2025.0160931},
  url       = {https://doi.org/10.14569/IJACSA.2025.0160931}
}

Open Access — licensed under a Creative Commons Attribution 4.0 International License. Unrestricted use, distribution, and reproduction in any medium, even commercially, as long as the original work is properly cited.