Forecasting the Tehran Stock market by Machine Learning Methods using a New Loss Function
Subject Areas : Financial EngineeringMahsa Tavakoli 1 , Hassan Doosti 2
1 - Department of Mathematics, Ferdowsi University of Mashhad, Mashhad, Iran
2 - Department of Mathematics and Statistics, Macquarie University, Sydney, Australia
Keywords: Artificial Neural Network, Support vector machine, Genetic Algorithm,
Abstract :
Stock market forecasting has attracted so many researchers and investors that many studies have been done in this field. These studies have led to the development of many predictive methods, the most widely used of which are machine learning-based methods. In machine learning-based methods, loss function has a key role in determining the model weights. In this study a new loss function is introduced, that has some special features, making the investing in the stock market more accurate and profitable than other popular techniques. To assess its accuracy, a two-stage experiment has been designed using data of Tehran Stock market. In the first part of the experiment, we select the most accurate algorithm among some of the well-known machine learning algorithms based on artificial neural network, ANN, support vector machine, SVM. In the second stage of the experiment, the various popular loss functions are compared with the proposed one. As a result, we introduce a new neural network using a new loss function, which is trained based on genetic algorithm. This network has been shown to be more accurate than other well-known and common networks such as long short-term memory (LSTM) for both train and test data.
[1] Murphy, J., Technical Analysis of the Financial Markets, New York Institute of Finance, 1999, P. 24-31.
[2] Huber, Peter J., Robust Estimation of a Location Parameter, Annals of Mathematical Statistics, 1964, 53 (1), P.73–101. Doi:10.1214/aoms/1177703732
[3] Warren S. and Walter P., A logical calculus of the ideas immanent in nervous activity, 1943, The bulletin of mathematical biophysics, 5, P.115–13.
[4] Vapnik, V., Golowich, S. E. and A. J. Smola, A. J., Support vector method for function approximation, regression estimation and signal processing, 1997, New York, Cambridge, MA: MIT Press.
[5] Hsu, S., Hsieh, J., Chih, T., and Hsu, K., A two-stage architecture for stock price forecasting by integrating self-organizing map and support vector regression, Expert Systems with Applications, 2009, 36(4), P.7947-7951. Doi:10.1016/j.eswa.2008.10.065
[6] Kimoto, T., Asakawa, K., Yoda, M., and Takeoka, M., Stock market prediction system with modular neural network, Proceedings of the International Joint Conference on Neural Networks, 1990, P.1–6. Doi:10.1109/ijcnn.1990.137535
[7] Hedayati Moghaddamb, A., Hedayati Moghaddamb, M. and Esfandyari, M., Stock market index prediction using artificial neural network, Journal of Economics, Finance and Administrative Science, 2016, 21, (41) , 89-93, Doi: 10.1016/j.jefas.2016.07.002
[8] Gandhmal, P., Dattatray and Kumar, K., Systematic analysis and review of stock market prediction techniques, Computer Science Review, 2019, 34, 100190. Doi:10.1016/j.cosrev.2019.08.001
[9] Diler, A., Forecasting the direction of ISE National-100 index by neural networks backpropagation algorithm, ISE Review, 2003, 7, P.65-81.
[10] Kim, K., Financial time series forecasting using support vector machines, Neurocomputing, 2003, 55(1-2), P.307-319. Doi:10.1016/s0925-2312(03)00372-2
[11] Nabipour, M., Nayyeri, P., Jabani, H., Mosavi, A., Salwana, E. and Shahab, S., Deep Learning for Stock Market Prediction, Entropy, 2020, 22, 840, Doi:10.3390/e22080840
[12] Huang, W., Nakamori, Y., and Shou-Yang, W., Forecasting stock market movement direction with support vector machine, Computers & Operations Research, 2005, 32, P.2513-2522. Doi:10.1016/j.cor.2004.03.016
[13] Altay, E., and Satman, M. H., Stock Market Forecasting: Artificial Neural Networks and Linear Regression Comparison in an Emerging Market, Journal of Financial Management and Analysis, 2005, 18(2), P.18-33.
[14] Cao, Q., Leggio, K. B., and Schniederjans, M.J., A comparison between Fama and French’s model and artificial neural networks in predicting the Chinese stock market, Computers & Operations Research, 2005, 32, P.2499-2512. Doi:10.1016/j.cor.2004.03.015
[15] Roh, T.H., Forecasting the volatility of stock price index, Expert Systems with Applications, 2007, 33, P.916–922. Doi:10.1016/j.eswa.2006.08.001
[16] Hyup Roh, T., Forecasting the volatility of stock price index, Expert Systems with Applications, 2007 33(4), P.916–922. Doi: 10.1016/j.eswa.2006.08.001
[17] Rashid, A., and Ahmad, S., Predicting stock returns volatility: An evaluation of linear vs. nonlinear methods, International Research Journal of Finance and Economics, 2008, 20, P.141–150.
[18] Manish, k., and Thenmozhi, M., Forecasting stock index movement: A comparison of support vector machines and random forest, Indian Institute of Capital Market Conference, Mumbai India, 2005. Doi:10.2139/ssrn.876544
[19] Xu, X., Zhou, C., and Wang, Z., Credit scoring algorithm based on link analysis ranking with support vector machine, Expert Systems with Applications, 2009, 36 (2), P.2625-2632. Doi:10.1016/j.eswa.2008.01.024
[20] Kara, Y., Boyacioglu, M.A., Baykan, O.K., Predicting direction of stock price index movement using artificial machines: the sample of the IStanbul STock Exchange, Expert Systems with Applications, 2011, 38(5), P.5311-5319. Doi:10.1016/j.eswa.2010.10.027
[21] Kara, Y., AcarBoyacioglu, M., and Baykan, O.K., Predicting direction of stock price index movement using artificial neural networks and support vector machines: The sample of the Istanbul Stock Exchange, Expert Systems with Applications, 2011, 38 (5), P.5311–5319. Doi: 10.1016/j.eswa.2010.10.027
[22] Patel, J., Shah, S., Thakkar, P., and Kotecha, K., Predicting stock market index using fusion of machine learning techniques, Expert Systems with Applications, 2015, 42 (4), P.2162–2172. Doi: 10.1016/ j.eswa.2014. 10.031
[23] Patel, J., Shah, S., Thakkar, P., and Kotecha, K., Predicting stock and stock price index movement using trend deterministic data preparation and machine learning techniques, Expert Systems with Applications, 2015,42(1), P.259-268. Doi:10.1016/j.eswa.2014.07.040
[24] Štěpánek, J., Šťovíček, J., Cimler, R., Application of Genetic Algorithms in Stock Market Simulation, Social and Behavioral Sciences, 2012, 47, P.93-97. Doi:10.1016/j.sbspro.2012.06.619
[25] Montri, I., Veera B., and Sarun I., Artificial Neural Network and Genetic Algorithm Hybrid Intelligence for Predicting Thai Stock Price Index Trend, Computational Intelligence and Neuroscience, 2016 ID, 6878524 Doi:10.1155/2016/3045254
[26] Hsu, M.W., Lessmann, S., Sung, M.C., Ma, T. and Johnson, J.E., Bridging the divide in financial market forecasting: machine learners vs. Financial economists, Expert Systems with Applications, 2016, 61(1), P.215-234. Doi:10.1016/j.eswa.2016.05.033
[27] Inthachot, M., Boonjing, V., and Intakosum, S., Artificial Neural Network and Genetic Algorithm Hybrid Intelligence for Predicting Thai Stock Price Index Trend, Computational Intelligence and Neuroscience, 2016, ID 3045254. Doi:10.1155/2016/3045254
[28] Ramezanian, R., Peymanfar, A., and Ebrahimi, S. B., 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 Journal, 2019, 82, 105551. Doi: 10.1016/ j.asoc.
[29] Matyjaszek, M., Fernández, P. R., Krzemień, A., Wodarski, K. and Valverde G. F., Forecasting coking coal prices by means of ARIMA models and neural networks, considering the transgenic time series theory. Resources Policy, 2019, 61, P.283-292. Doi:10.1016/j.resourpol.2019.02.017
[30] Matheus, J. S. S., Fahad, F. W. A., Bruno, M. H., Ana B. N., aDanilo, G. R., Vinicius A.S. and Herbert K., Can artificial intelligence enhance the Bitcoin bonanza, The Journal of Finance and Data Science, 2019, 5, P.83-98. Doi:10.1016/j.jfds.2019.01.002
[31] Alberta, A. A., Lópezb, L. F. M., and Blasb, N. G., Multi linear Weighted Regression (MWE) with Neural Networks for trend prediction, Applied Soft Computing Journal, 2019, 82, 105555. Doi:0.1016/j.asoc.2019.105555
[32] Botchkarev, A., Performance Metrics (Error Measures) in Machine Learning Regression, Forecasting and Prognostics: Properties and Typology, Interdisciplinary Journal of Information, Knowledge, and Management, 2019, 14, P.45-79. Doi:10.28945/4184
[33] Shah, D., Isah, H., Zulkernine, F., Stock market analysis: A review and taxonomy of prediction techniques, Int. J. Financial Stud., 2019, 7(2), 26. Doi: 10.3390/ijfs7020026.
[34] Zhong, X., Enke, D., Predicting the daily return direction of the stock market using hybrid machine learning algorithms. Financial Innovation, 2019, 5 (1), 1-20. Doi: 10.1186/s40854-019-0138-0
[35] Wen, M., Li, P., Zhang, L., Chen, Y., Stock Market Trend Prediction Using High-Order Information of Time Series, IEEE Access 2019, 7, 28299–28308. Doi: 10.1109/ACCESS.2019.2901842
[36] Cervelló-Royo, R., Guijarro, F., Forecasting stock market trend: A comparison of machine learning algorithms, Financ. Mark. Valuat. 2020, 6, 37–49. Doi: 10.46503/NLUF8557
[37] Papageorgiou, K.I., Poczeta, K., Papageorgiou, E., Gerogiannis, V.C., Stamoulis, G., Exploring an Ensemble of Methods that Combines Fuzzy Cognitive Maps and Neural Networks in Solving the Time Series Prediction: Problem of Gas Consumption in Greece. Algorithms, 2019, 12 (11), 235. Doi: 10.3390/a12110235
[38] Etebar, S., Darabi, R., Hamidiyan, M., and Jafari, S.M., Evaluation of Intelligent and Statistical Prediction Models for Overconfidence of Managers in the Iranian Capital Market Companies, Advances in Mathematical Finance and Applications, 2020, Articles in Press. Doi: 10.22034/amfa.2019.579662.1145
[39] Ghasemzadeha, M., Mohammad-Karimi, N., Ansari-Samani, H., Machine learning algorithms for time series in financial markets, Advances in Mathematical Finance and Applications, 2020, 4(5), P. 479-490. Doi:10.22034/amfa.2020.674946
[40] Davoodi Kasbi, A., Dadashi, I., Stock price prediction using the Chaid rule-based algorithm and particle swarm optimization (pso), Advances in Mathematical Finance and Applications, 2020, 2(5), P. 197-213. Doi 10.22034/amfa.2019.585043.1184
[41] Tavana, M., Izadikhah, M., Di Caprio, D., Farzipoor Saen, R., A new dynamic range directional measure for two-stage data envelopment analysis models with negative data, Computers & Industrial Engineering, 2018, 115, P. 427-448, Doi: 10.1016/j.cie.2017.11.024
[42] Randall, S., Sexton, Jatinder, N. D., and Gupta, b., Comparative evaluation of genetic algorithm and backpropagation for training neural networks, Information Sciences, 2000, 129, P.45-59. Doi:10.1016/s0020-0255(00)00068-2
[43] Izadikhah, M., Improving the Banks Shareholder Long Term Values by Using Data Envelopment Analysis Model, Advances in Mathematical Finance and Applications, 2018, 3(2), P. 27-41. Doi: 10.22034/amfa.2018.540829
[44] Dorsey, R.E., Mayer, W.J., Optimization Using Genetic Algorithms, Advances, in: J.D. Johnson, A.B. Whinston (Eds.), Artificial Intelligence in Economics, Finance, and Management, Vol. 1. JAI Press Inc., Greenwich, CT, P.1994.
[45] Dorsey, R.E., Mayer, W.J., Genetic algorithms for estimation problems with multiple optima, non-differentiability and other irregular features, Journal of Business and Economic Statistics, 1995, 13, P.53-66. Doi:10.2307/1392521
[46] Dibachi, H., Behzadi. MH, Izadikhah, M., Stochastic Modified MAJ Model for Measuring the Efficiency and Ranking of DMUs, Indian Journal of Science and Technology, 2015, 8 (8), P. 549–555, Doi: 10.17485/ijst/2015/v8iS8/71505
[47] Sinayi, H., Mortazavi, S., Teymoori Asl, Y., Tehran Stock Exchange Index forecasting using artificial
neural networks, Journal of Accounting and Auditing Review, 2005, 41, 59-83.