Buying and selling strategy in the Iranian stock market using machine learning models, with feature selection using the Cuckoo Search algorithm

Document Type : Original Article

Authors

Faculty of Electrical and Computer Engineering, University of Science and Technology of Mazandaran, Behshahr, Iran

Abstract

In Iran, the stock market is facing different conditions compared to the rest of the world. One of the most important challenges in this market is the lack of transparency in market information and information on trading companies. Also, the lack of appropriate and complete historical data for use in forecasting algorithms is another important challenge. In stock price forecasting, due to the dynamic interactions of the stock market and price changes in short periods of time, the use of artificial intelligence is used as a powerful tool in price forecasting and decisions related to buying and selling stocks. In this paper, a method based on machine learning, including five steps (including data labeling, feature extraction, feature selection, classification, and signal presentation), is presented. For this purpose, various technical characteristics have been extracted from the price data, and the data has been labeled using the threshold labeling method. Then, various machine learning models are trained on this data and provide buy and sell signals at the output. To improve the performance of the machine learning model, feature selection has been done using the Cuckoo Search algorithm. In order to evaluate the proposed method, several years of Iranian stock market data and various indices have been used. The results of the evaluation show the effectiveness of the proposed method.

Keywords

Main Subjects


[1] D. Selvamuthu, V. Kumar, and A. Mishra, “Indian stock market prediction using artificial neural networks on tick data,” Financ. Innov., vol. 5, p. 16, 2019, doi: 10.1186/s40854-019-0131-7.
[2] J. Qiu, B. Wang, and C. Zhou, “Forecasting Stock Prices with Long-Short Term Memory Neural Network Based on Attention Mechanism,” PLOS ONE, vol. 15, no. 1, 2020, p. e0227222, doi: 10.1371/journal.pone.0227222.
[3] P. Yu and X. Yan, “Stock Price Prediction Based on Deep Neural Networks,” Neural Comput. Appl., vol. 32, no. 6, pp. 1609-1628, 2020, doi: 10.1007/s00521-019-04212-x.
[4] G. Ding and L. Qin. “Study on the Prediction of Stock Price Based on the Associated Network Model of LSTM,” Int. J. Mach. Learn. Cybern., vol. 11, no. 6, pp. 1307-1317, 2020, doi: 10.1007/s13042-019-01041-1.
[5] T. Kim and H.Y. Kim, “Forecasting Stock Prices with a Feature Fusion LSTM-CNN Model Using Different Representations of the Same Data,” PLOS ONE, vol. 14, no. 2, 2019, p. e0212320, doi: 10.1371/journal.pone.0212320.
[6] P. Meesad and R. I. Rasel, “Predicting stock market price using support vector regression,” in Int. Conf. Inf. Electron. Vision (ICIEV), Dhaka, Bangladesh, 2013, pp. 1-6, doi: 10.1109/ICIEV.2013.6572570.
[7] M. Obthong, N. Tantisantiwong, W. Jeamwatthanachai, and G.B. Wills, “A Survey on Machine Learning for Stock Price Prediction: Algorithms and Techniques,” in Proc. 2nd Int. Conf. Fin. Econ. Manag. IT Bus. (FEMIB), Prague, Czech Republic, 2020, pp. 63-71, doi: 10.5220/0009340700630071.
[8] J. Pan, Y. Zhuang, and S. Fong, “The Impact of Data Normalization on Stock Market Prediction: Using SVM and Technical Indicators,” in Proc. 2nd Int. Conf. Soft Comput. Data Sci. (SCDS), Kuala Lumpur, Malaysia, 2016, pp. 72-88, doi: 10.1007/978-981-10-2777-2_7.
[9] P. Ghosh, A. Neufeld, and J.K. Sahoo, “Forecasting Directional Movements of Stock Prices for Intraday Trading Using LSTM and Random Forests,” Fin. Res. Letters, vol. 46, p. 102280, 2022, doi: 10.1016/j.frl.2021.102280.
[10] J. Zhang, L. Li, and W. Chen, “Predicting Stock Price Using Two-Stage Machine Learning Techniques,” Comput. Econ., vol. 57, pp. 1237–1261, 2021, doi: 10.1007/s10614-020-10013-5.
[11] B.B. Nair, N.M. Dharini, and V.P. Mohandas, “A Stock Market Trend Prediction System Using a Hybrid Decision Tree-Neuro-Fuzzy System,” in Int. Conf. Adv. Recent Technol. Commun. Comput., Kottayam, India, 2010, pp. 381-385, doi: 10.1109/ARTCom.2010.75. 
[12] S.S. Panigrahi and J.K. Mantri, “Epsilon-SVR and decision tree for stock market forecasting,” in Int. Conf. Green Comput. Internet Things (ICGCIoT), Greater Noida, India, 2015, pp. 761-766, doi: 10.1109/ICGCIoT.2015.7380565. 
[13] D. Enke, M. Grauer, and N. Mehdiyev, “Stock Market Prediction with Multiple Regression, Fuzzy Type-2 Clustering and Neural Networks,” in Proc. Complex Adapt. Syst. Conf., Chicago, Illinois, USA, 2011, pp. 201-206, doi: 10.1016/j.procs.2011.08.038.
[14] Y.E. Cakra and B.D. Trisedya, “Stock price prediction using linear regression based on sentiment analysis,” in Int. Conf. Adv. Comput. Sci. Inf. Syst. (ICACSIS), Depok, Indonesia, 2015, pp. 147-154, doi: 10.1109/ICACSIS.2015.7415179.
[15] B. Panwar, G. Dhuriya, P. Johri, S. Singh Yadav, and N. Gaur, “Stock Market Prediction Using Linear Regression and SVM,” in Int. Conf. Adv. Comput. Innov. Technol. Eng. (ICACITE), Greater Noida, India, 2021, pp. 629-631, doi: 10.1109/ICACITE51222.2021.9404733.
[16] A. Izzah, Y.A. Sari, R. Widyastuti, and T. A. Cinderatama, “Mobile app for stock prediction using Improved Multiple Linear Regression,” in Int. Conf. Sustain. Inf. Eng. Technol. (SIET), Malang, Indonesia, 2017, pp. 150-154, doi: 10.1109/SIET.2017.8304126.
[17] D. Enke and N. Mehdiyev, “Stock Market Prediction Using a Combination of Stepwise Regression Analysis, Differential Evolution-Based Fuzzy Clustering, and a Fuzzy Inference Neural Network,” Intell. Autom. Soft Comput., vol. 19, no. 4, pp. 636-48, 2013, doi: 10.1080/10798587.2013.839287.
[18] W. Khan, M.A. Ghazanfar, M.A. Azam, A. Karami, K.H. Alyoubi, and A.S. Alfakeeh, “Stock Market Prediction Using Machine Learning Classifiers and Social Media, News,” J. Ambient Intell. Humaniz. Comput., vol. 13, no. 7, pp. 3433-3456, 2022, doi: 10.1007/s12652-020-01839-w.
[19] S. Mehtab, J. Sen, and A. Dutta, “Stock Price Prediction Using Machine Learning and LSTM-Based Deep Learning Models,” in Machine Learning and Metaheuristics Algorithms, and Applications. (SoMMA), Commun. Comput. Inf. Sci., vol 1366, Springer, Singapore, 2021, doi: 10.1007/978-981-16-0419-5_8.
[20] M. Vijh, D. Chandola, V.A. Tikkiwal, and A. Kumar, “Stock Closing Price Prediction Using Machine Learning Techniques,” Procedia Comput. Sci., vol. 167, pp. 599-606, 2020, doi: 10.1016/j.procs.2020.03.326.
[21] W. Chen, H. Zhang, M.K. Mehlawat, and L. Jia, “Mean–Variance Portfolio Optimization Using Machine Learning-Based Stock Price Prediction,” Appl. Soft Comput., vol. 100, p. 106943, 2021, doi: 10.1016/j.asoc.2020.106943.
[22] J. Patel, S. Shah, P. Thakkar, and K. Kotecha, “Predicting Stock and Stock Price Index Movement Using Trend Deterministic Data Preparation and Machine Learning Techniques,” Expert Syst. Appl., vol. 42, no. 1, pp. 259-268, 2015, doi: 10.1016/j.eswa.2014.07.040.
[23] X. Zhang, Y. Hu, K. Xie, S. Wang, E.W.T. Ngai, and M. Liu, “A Causal Feature Selection Algorithm for Stock Prediction Modeling,” Neurocomputing, vol. 142, pp. 48-59, 2014, doi: 10.1016/j.neucom.2014.01.057.
[24] M. Gocken, M. Ozcalici, A. Boru, and A.T. Dosdogru, “Stock Price Prediction Using Hybrid Soft Computing Models Incorporating Parameter Tuning and Input Variable Selection,” Neural Comput. Appl., vol. 31, no. 2, pp. 577-592, 2019, doi: 10.1007/s00521-017-3089-2.
[25] M. Wen, P. Li, L. Zhang, and Y. Chen, “Stock Market Trend Prediction Using High-Order Information of Time Series,” IEEE Access, vol. 7, pp. 28299-28308, 2019, doi: 10.1109/access.2019.2901842.
[26] R.K. Nayak, et al., “Indian Stock Market Prediction Based on Rough Set and Support Vector Machine Approach,” in Intell. Cloud Comput. Smart Innov. Syst. Technol., vol 153, Springer, Singapore, 2021, doi: 10.1007/978-981-15-6202-0_35.
[27] Y. Peng, P.H.M. Albuquerque, H. Kimura, and C.A.P.B. Saavedra, “Feature Selection and Deep Neural Networks for Stock Price Direction Forecasting Using Technical Analysis Indicators,” Mach. Learn. Appl., vol. 5, p. 100060, 2021, doi: 10.1016/j.mlwa.2021.100060. 
[28] X. Yuan, J. Yuan, T. Jiang, and Q.U. Ain, “Integrated Long-Term Stock Selection Models Based on Feature Selection and Machine Learning Algorithms for China Stock Market,” IEEE Access, vol. 8, pp. 22672–22685, 2020, doi: 10.1109/access.2020.2969293. 
[29] H. Veisi, H.R. Ghaedsharaf, and M. Ebrahimi, “Improving the Performance of Machine Learning Algorithms for Heart Disease Diagnosis by Optimizing Data and Features,” Soft Comput. J., vol. 8, no. 1, pp. 70-85, 2019, doi: 10.22052/8.1.70 [In Persian].
[30] A.A.A. Mahdavi and E. Mahdipour, “Prediction of couple relationship during the Covid-19 period using correlation-based feature selection and machine learning,” Soft Comput. J., vol. 10, no. 2, pp. 56-71, 2022, doi: 10.22052/scj.2022.243472.1040 [In Persian].
[31] M. Bigdeli, “Classification of transformer faults using frequency response analysis based on cross-correlation technique and support vector machine,” Soft Comput. J., vol. 9, no. 1, pp. 2-13, 2020, doi: 10.22052/scj.2021.111448 [In Persian].
[32] X.-S. Yang and S. Deb, “Cuckoo Search: Recent Advances and Applications,” Neural Comput. Appl., vol. 24, no. 1, pp. 169-174, 2014, doi: 10.1007/s00521-013-1367-1. 
[33] L.A.M. Pereira, “A Binary Cuckoo Search and Its Application for Feature Selection,” in Cuckoo Search and Firefly Algorithm. Studies in Computational Intelligence, vol 516, Springer, Cham, 2014, doi: 10.1007/978-3-319-02141-6_7.