Generating Trading Strategy Using Candlesticks Pattern with Machine Learning

Hussaina Bala Malami, Badamasi Imam Ya'u, Fatima Umar Zambuk, Abuzairu Ahmad

Abstract


The proposed work considered to implementing a multiple-day trading strategy using ML algorithms that integrate candlestick patterns and technical indicators on the Nigerian Stock Exchange stock prices from 2013 to 2023. The results obtained from different models, including Linear Regression, Ridge Regression, Support Vector Regressor  (SVR), K-Nearest Neighbors (KNN), and Decision Tree, were compared to find the best model with the highest potential to generalize well on future stock prices. The various algorithms were implemented in Python 3.10 alongside other important third-party packages such as Pandas, TA-Lib, Scikit-learn, and Skforecast. These packages were utilized for the various data tasks needed for this research. The data was cleaned and thoroughly explored before performing feature engineering, such as generating candlestick patterns and appending technical indicators like Simple Moving Average (SMA), Exponential Moving Average (EMA), and Volume Rate of Change (VROC). The data was split into train, validation, and test sets to avoid data leakage. Additionally, the various features underwent transformations, including standardization, before being passed to the algorithms for training and evaluation.


Full Text:

PDF

References


Brasileiro, R. C., Souza, V. L., Fernandes, B. J., & Oliveira, A. L. (2013). Automatic method for stock trading combining technical analysis and the artificial bee colony algorithm. In 2013 IEEE Congress on Evolutionary Computation (pp. 1810-1817). IEEE.

Bustos, O., & Pomares-Quimbaya, A. (2020). Stock market movement forecast: A systematic review. Expert Systems with Applications, 156, 113464.

Caginalp, G., & Laurent, H. (1998). The predictive power of price patterns. Applied Mathematical Finance, 5(3-4), 181-205.

Chiang, W. C., Enke, D., Wu, T., & Wang, R. (2016). An adaptive stock index trading decision support system. Expert Systems with Applications, 59, 195-207.

Ding, X., Zhang, Y., Liu, T., & Duan, J. (2015, June). Deep learning for event-driven stock prediction. In Twenty-fourth international joint conference on artificial intelligence.

Fischer, T., & Krauss, C. (2018). Deep learning with long short-term memory networks for financial market predictions. European journal of operational research, 270(2), 654-669.

Fock, J. H., Klein, C., & Zwergel, B. (2005). Performance of candlestick analysis on intraday futures data. The Journal of Derivatives, 13(1), 28-40.

Goo, Y. J., Chen, D. H., & Chang, Y. W. (2007). The application of Japanese candlestick trading strategies in Taiwan. Investment Management and Financial Innovations, (4, Iss. 4), 49-79.

Kamo, T., & Dagli, C. (2009). Hybrid approach to the Japanese candlestick method for financial forecasting. Expert Systems with applications, 36(3), 5023-5030.

Lee, C. H. L. (2009, July). Modeling personalized fuzzy candlestick patterns for investment decision making. In 2009 Asia-Pacific conference on information processing (Vol. 2, pp. 286-289). IEEE.

Wang, Q., Xu, W., & Zheng, H. (2018). Combining the wisdom of crowds and technical analysis for financial market prediction using deep random subspace ensembles. Neurocomputing, 299, 51-61.

Zhang, J., Li, L., & Chen, W. (2021). Predicting stock price using two-stage machine learning techniques. Computational Economics, 57, 1237-1261.

Zhou, F., Zhang, Q., Sornette, D., & Jiang, L. (2019). Cascading logistic regression onto gradient boosted decision trees for forecasting and trading stock indices. Applied Soft Computing, 84, 105747.

Zhu, M., Atri, S., & Yegen, E. (2016). Are candlestick trading strategies effective in certain stocks with distinct features?. Pacific-Basin Finance Journal, 37, 116-127.


Refbacks

  • There are currently no refbacks.