Document Type : Original Research Paper


Department of Electrical and Computer Engineering, University of Birjand, Birjand, Iran


Background and Objectives: Stock price prediction has become one of the interesting and also challenging topics for researchers in the past few years. Due to the non-linear nature of the time-series data of the stock prices, mathematical modeling approaches usually fail to yield acceptable results. Therefore, machine learning methods can be a promising solution to this problem.
Methods: In this paper, a novel machine learning approach, which works in two phases, is introduced to predict the price of a stock in the next day based on the information extracted from the past 26 days. In the first phase of the method, an automatic clustering algorithm clusters the data points into different clusters, and in the second phase a hybrid regression model, which is a combination of particle swarm optimization and support vector regression, is trained for each cluster. In this hybrid method, particle swarm optimization algorithm is used for parameter tuning and feature selection. Results: The accuracy of the proposed method has been measured by 5 companies’ datasets, which are active in the Tehran Stock Exchange market, through 5 different metrics. On average, the proposed method has shown 82.6% accuracy in predicting stock price in 1-day ahead.
Conclusion: The achieved results demonstrate the capability of the method in detecting the sudden jumps in the price of a stock.

©2020 The author(s). This is an open access article distributed under the terms of the Creative Commons Attribution (CC BY 4.0), which permits unrestricted use, distribution, and reproduction in any medium, as long as the original authors and source are cited. No permission is required from the authors or the publishers.


Main Subjects

[1] J. J. Murphy, Technical analysis of the financial markets: A comprehensive guide to trading methods and applications: Penguin, 1999.

[2] J. Patel, S. Shah, P. Thakkar, K. Kotecha, "Predicting stock and stock price index movement using trend deterministic data preparation and machine learning techniques," Expert systems with applications, 42(1): 259-268, 2015.

[3] H. Larochelle, Y. Bengio, J. Louradour, P. Lamblin, "Exploring strategies for training deep neural networks," Journal of machine learning research, 10(1): 1-40, 2009.

[4] H. Drucker, C. J. Burges, L. Kaufman, A. J. Smola, and V. Vapnik, "Support vector regression machines," in Advances in neural information processing systems, 1997): 155-161.

[5] J. Kennedy and R. Eberhart, "Particle swarm optimization," in Proceedings of ICNN'95-International Conference on Neural Networks,: 1942-1948, 1995.

[6] M. Hasanluo, F. Soleimanian Gharehchopogh, "Software Cost Estimation by a New Hybrid Model of Particle Swarm Optimization and K-Nearest Neighbor Algorithms," Journal of Electrical and Computer Engineering Innovations (JECEI), 4(1): 49-55, 2016.

[7] M. Khosravy, N. Gupta, N. Patel, T. Senjyu, C. A. Duque, "Particle swarm optimization of morphological filters for electrocardiogram baseline drift estimation," in Applied nature-inspired computing: algorithms and case studies, ed: Springer, 2020 : 1-21, 2020

[8] P. Zhang, Z.-Y. Yin, Y.-F. Jin, T. H. Chan, "A novel hybrid surrogate intelligent model for creep index prediction based on particle swarm optimization and random forest," Engineering Geology, 265(1): 105328, 2020.

[9] J. Liang, S. Ge, B. Qu, K. Yu, F. Liu, H. Yang, et al., "Classified perturbation mutation based particle swarm optimization algorithm for parameters extraction of photovoltaic models," Energy Conversion and Management, 203(1): 112138, 2020.

[10] N. Gozalpour M. Teshnehlab, "Forecasting Stock Market Price Using Deep Neural Networks," in 2019 7th Iranian Joint Congress on Fuzzy and Intelligent Systems (CFIS),: 1-4, 2019.

[11] R. Singh, S. Srivastava, "Stock prediction using deep learning," Multimedia Tools and Applications, 76(18): 18569-18584, 2017.

[12] R. Ramezanian, A. Peymanfar, S. B. Ebrahimi, "An integrated framework of genetic network programming and multi-layer perceptron neural network for prediction of daily stock return: An application in Tehran stock exchange market," Applied Soft Computing, 82(1): 105551, 2019.

[13] M. Ghanbari, H. Arian, "Forecasting Stock Market with Support Vector Regression and Butterfly Optimization Algorithm," arXiv preprint arXiv:1905.11462, 2019.

[14] J. Zahedi, M. M. Rounaghi, "Application of artificial neural network models and principal component analysis method in predicting stock prices on Tehran Stock Exchange," Physica A: Statistical Mechanics and its Applications, 438(1): 178-187, 2015.

[15] R. Akita, A. Yoshihara, T. Matsubara, K. Uehara, "Deep learning for stock prediction using numerical and textual information," in 2016 IEEE/ACIS 15th International Conference on Computer and Information Science (ICIS),: 1-6, 2016.

[16] W. Khan, M. A. Ghazanfar, M. A. Azam, A. Karami, K. H. Alyoubi, A. S. Alfakeeh, "Stock market prediction using machine learning classifiers and social media, news," Journal of Ambient Intelligence and Humanized Computing, 1(1): 1-24, 2020.

[17] Z. Rustam, P. Kintandani, "Application of Support Vector Regression in Indonesian Stock Price Prediction with Feature Selection Using Particle Swarm Optimisation," Modelling and Simulation in Engineering, 1(1), 2019.

[18] A. Omidi, E. Nourani, M. Jalili, "Forecasting stock prices using financial data mining and Neural Network," in 2011 3rd International Conference on Computer Research and Development, 3(1): 242-246, 2011.

[19] M. Göçken, M. Özçalıcı, A. Boru, A. T. Dosdoğru, "Stock price prediction using hybrid soft computing models incorporating parameter tuning and input variable selection," Neural Computing and Applications, 31(2): 577-592, 2019.

[20] M. Nikou, G. Mansourfar, J. Bagherzadeh, "Stock price prediction using DEEP learning algorithm and its comparison with machine learning algorithms," Intelligent Systems in Accounting, Finance and Management, 26(4): 164-174, 2019.

[21] S. K. Chandar, "Grey Wolf optimization-Elman neural network model for stock price prediction," Soft Computing, 1(1): 1-10, 2020.

[22] D. P. Gandhmal, K. Kumar, "Systematic analysis and review of stock market prediction techniques," Computer Science Review, 34(1): 100190, 2019.

[23] T. T.-L. Chong, W.-K. Ng, "Technical analysis and the London stock exchange: testing the MACD and RSI rules using the FT30," Applied Economics Letters, 15: 1111-1114, 2008.

[24] I. Behravan, S. H. Zahiri, S. M. Razavi, R. Trasarti, "Clustering a Big Mobility Dataset Using an Automatic Swarm Intelligence-Based Clustering Method," Journal of Electrical and Computer Engineering Innovations, 6(2): 243-262, 2018.

[25] I. Behravan, S. H. Zahiri, S. M. Razavi, R. Trasarti, "Finding Roles of Players in Football Using Automatic Particle Swarm Optimization-Clustering Algorithm," Big data, 7(1): 35-56, 2019.

[26] J. A. Suykens, J. Vandewalle, "Least squares support vector machine classifiers," Neural processing letters, 9(3): 293-300, 1999.

[27] V. Vapnik, The nature of statistical learning theory: Springer science & business media, 2013.

[28] C.Y. Yeh, C.W. Huang, S.-J. Lee, "A multiple-kernel support vector regression approach for stock market price forecasting," Expert Systems with Applications, 38(3): 2177-2186, 2011.

[29] R. Tibshirani, G. Walther, T. Hastie, "Estimating the number of clusters in a data set via the gap statistic," Journal of the Royal Statistical Society: Series B (Statistical Methodology), 63(2): 411-423, 2001.

[30] A. Cuevas, M. Febrero, R. Fraiman, "Estimating the number of clusters," Canadian Journal of Statistics, 28(2): 367-382, 2000.

[31] D. Pelleg, A. W. Moore, "X-means: Extending k-means with efficient estimation of the number of clusters," in Icml, : 727-734, 2000.


[32] U. Maulik , S. Bandyopadhyay, "Performance evaluation of some clustering algorithms and validity indices," IEEE Transactions on pattern analysis and machine intelligence, 24(12): 1650-1654, 2002.

[33] A. S. Shirkhorshidi, S. Aghabozorgi, T. Y. Wah, T. Herawan, "Big data clustering: a review," in International conference on computational science and its applications,: 707-720: 2014.

[34] S. Sengupta, S. Basak, R. A. Peters, "Particle Swarm Optimization: A survey of historical and recent developments with hybridization perspectives," Machine Learning and Knowledge Extraction, 1(1): 157-191, 2019.

[35] W.-l. Xiong, B.-g. Xu, "Study on optimization of SVR parameters selection based on PSO," Journal of System Simulation, 18: 2442-2445, 2006.

[36] W. Hu, L. Yan, K. Liu, H. Wang, "Pso-svr: A hybrid short-term traffic flow forecasting method," in 2015 IEEE 21st International Conference on Parallel and Distributed Systems (ICPADS),: 553-561, 2015.

[37] I. Behravan, O. Dehghantanha, S. H. Zahiri, "An optimal SVM with feature selection using multi-objective PSO," in 2016 1st IEEE Conference on Swarm Intelligence and Evolutionary Computation (CSIEC),: 76-81, 2016.


Journal of Electrical and Computer Engineering Innovations (JECEI) welcomes letters to the editor for the post-publication discussions and corrections which allows debate post publication on its site, through the Letters to Editor. Letters pertaining to manuscript published in JECEI should be sent to the editorial office of JECEI within three months of either online publication or before printed publication, except for critiques of original research. Following points are to be considering before sending the letters (comments) to the editor.

[1] Letters that include statements of statistics, facts, research, or theories should include appropriate references, although more than three are discouraged.

[2] Letters that are personal attacks on an author rather than thoughtful criticism of the author’s ideas will not be considered for publication.

[3] Letters can be no more than 300 words in length.

[4] Letter writers should include a statement at the beginning of the letter stating that it is being submitted either for publication or not.

[5] Anonymous letters will not be considered.

[6] Letter writers must include their city and state of residence or work.

[7] Letters will be edited for clarity and length.