Document Type : Research Article


Department of Industrial Engineering, Engineering Faculty, Meybod University, Yazd, Iran


Safe investment can be experienced by incorporating human experience and modern predicting

science. Artificial Intelligence (AI) plays a vital role in reducing errors in this winning layout. This study

aims at performance analysis of Deep Learning (DL) and Machine Learning (ML) methods in modelling

and predicting the stock returns time series based on the return rate of previous periods and a set of

exogenous variables. The data used includes the weekly data of the stock return index of 200 companies

included in the Tehran Stock Exchange market from 2016 to 2021. Two Long Short-Term Memory (LSTM)

and Deep Q-Network (DQN) models as DL processes and two Random Forest (RF) and Support Vector

Machine (SVM) models as ML algorithms were selected. The results showed the superiority of DL

algorithms over ML, which can indicate the existence of strong dependence patterns in these time series,

as well as relatively complex nonlinear relationships with uncertainty between the determinant variables.

Meanwhile, LSTM with R-squared equals to 87 percent and the analysis of the results of five other

evaluation models have shown the highest accuracy and the least error of prediction. On the other hand, the

RF model results in the least prediction accuracy by including the highest amount of error.


[1] K. Abbasi Museloo A. Saranj, R. Tehrani and M. Nadiri, Identifying the trading behaviors
and risk of noise traders in iran stock market, Financial Management Strateg 6 (2018), no. 3,
[2] Masaya Abe and Hideki Nakayama, Deep learning for forecasting stock returns in the crosssection, Advances in Knowledge Discovery and Data Mining: 22nd Pacific-Asia Conference,
PAKDD 2018, Melbourne, VIC, Australia, June 3-6, 2018, Proceedings, Part I 22, Springer,
2018, pp. 273–284.
[3] Amin Aminimehr, Saeed Bajalan, and Hanieh Hekmat, A study on the characteristics of
tse index return data and introducing a regime switching prediction method based on neural
networks, Journal of Financial Management Perspective 11 (2021), no. 34, 145–171.
[4] Mohammad Javad Badiei, A deep learning approach for analyzing and forecasting time series
of financial data, 2018.
[5] Wei Bao, Jun Yue, and Yulei Rao, A deep learning framework for financial time series using
stacked autoencoders and long-short term memory, PloS one 12 (2017), no. 7, e0180944.
[6] Gourav Bathla, Stock price prediction using lstm and svr, 2020 Sixth International Conference on Parallel, Distributed and Grid Computing (PDGC), IEEE, 2020, pp. 211–214.
[7] Melike Bildirici and Ozg ¨ ur Ersin, ¨ Markov-switching vector autoregressive neural networks
and sensitivity analysis of environment, economic growth and petrol prices, Environmental
Science and Pollution Research 25 (2018), no. 31, 31630–31655.
[8] Helder Ferreira de Mendon¸ca and Ivando Faria, Financial market reactions to announcements of monetary policy decisions: Evidence from the brazilian case, Journal of Economic
Studies 40 (2013), no. 1, 54–70.
[9] Saba GhaziAskari, Najmeh Neshat, and AbbasAli Jafari Nodoushan, Sustainable policymaking of financial systems in crisis situations with modelling based on artificial neural
networks, Financial Management Perspective 12 (2022), no. 38, 103–129.
[10] Zou Haofei, Xia Guoping, Yang Fangting, and Yang Han, A neural network model based on
the multi-stage optimization approach for short-term food price forecasting in china, Expert
Systems with Applications 33 (2007), no. 2, 347–356.
[11] Efstathios Kalyvas, Using neural networks and genetic algorithms to predict stock market
returns, University of Manchester Master of Science thesis (2001).
[12] Luckyson Khaidem, Snehanshu Saha, and Sudeepa Roy Dey, Predicting the direction of stock
market prices using random forest, arXiv preprint arXiv:1605.00003 (2016).
[13] Maryam Khaleghi Zadeh Dehkordi, Fatemeh Sarraf, and Ali Najafi Moghadam, Application
of artificial intelligence algorithm in predicting investment efficiency emphasizing the role
of risk management criteria, Journal of Investment Knowledge 11 (2022), no. 42, 413–434.
[14] Seyed Ali Khoshroo and Seyed Hossein Khasteh, Increase the speed of the dqn learning
process with the eligibility traces, Journal of Control 14 (2021), no. 4, 13–23.
[15] Manish Kumar and M Thenmozhi, Forecasting stock index movement: A comparison of
support vector machines and random forest, Indian institute of capital markets 9th capital
markets conference paper, 2006.
[16] Mahmood Lari Dasht and Shaban Mohammadi, A regular bayesian meural network to predict
the stock market, Journal of Accounting and Social Interests 6 (2016), no. 4, 67–82.
[17] Yilin Ma, Ruizhu Han, and Weizhong Wang, Portfolio optimization with return prediction
using deep learning and machine learning, Expert Systems with Applications 165 (2021),
[18] Reza Maulana, Wahyu Nugraha, Nurmalasari Nurmalasari, Latifah Latifah, and Panny Agustia Rahayuningsih, Comparison of data mining algorithm in predicting tlkm stock price, 2714
(2023), no. 1.
[19] Nader Mehregan and Mohamad Ali Ahmadi Ghomi, Exchange rate shocks and financial markets: An application of panel vector autoregression model (panel var), Journal of Economic
Research and Policies 23 (2016), no. 75, 103–130.
[20] Sidra Mehtab and Jaydip Sen, A time series analysis-based stock price prediction using
machine learning and deep learning models, International Journal of Business Forecasting
and Marketing Intelligence 6 (2020), no. 4, 272–335.
[21] Tom M Mitchell, Communications of the ACM 42 (1999), no. 11, 30–36.
[22] Mahmoud Moallem and Ali Akbar Pouyan, Anomaly detection using lstm autoencoder, Journal of Modeling in Engineering 17 (2019), no. 56, 191–211.
[23] Reza Najarzadeh, Mehdi Zolfaghari, and Samad Golami, Designing a model for forecasting
the return of the stock index (with emphasis on neural network combined models and longterm memory models), Journal of Investment Knowledge 9 (2020), no. 34, 231–257.
[24] Saeed Nayeb, Monireh Hadinejad, and Freshteh Shams Safa, The news impact of petrochemical feedstock prices increase on tehran stock market, Financial Economics 9 (2016), no. 33,
[25] N Neshat, M Sardari Zarchi, and H Mahlooji, Application of deep learning models based
on fully-connected and recurrent neural networks to residential peak load forecasting, Sharif
Journal of Industrial Engineering & Management 36 (2020), no. 1.2, 103–111.
[26] Mahla Nikou, Gholamreza Mansourfar, and Jamshid Bagherzadeh, Stock price prediction using deep learning algorithm and its comparison with machine learning algorithms, Intelligent
Systems in Accounting, Finance and Management 26 (2019), no. 4, 164–174.
[27] Rifando Panggabean and Yohana Dewi Lulu Widyasari, A comparison between super vector
regression, random forest regressor, lstm, and gru in forecasting bitcoin price, International
ABEC (2023), 281–287.
[28] Md Lutfur Rahman, Abu Amin, and Mohammed Abdullah Al Mamun, The covid-19 outbreak
and stock market reactions: Evidence from australia, Finance Research Letters 38 (2021),
[29] Mojtaba Rostami and Seyed Nezamuddin Makiyan, Tehran stock exchange return forecasting:
Comparison of bayesian, exponential smoothing and box jenkins approaches, Iranian Journal
of Economic Research 27 (2022), no. 91, 189–221.
[30] E Safari, Comparative analysis of machine learning models (support vector regression, deep
learning) and financial time series (arima, random walk) in stock price forecasting, 2019.
[31] Mohammad Sarchami, Ahmad Khodamipour, Majid Mohammadi, and Hadis Zeinali, Applying machine learning models in creation of share optimum portfolio and their comparison,
Financial Engineering and Portfolio Management 11 (2020), no. 45, 147–176.
[32] Nezhad Sakineh Sayadi, MAGHARI ALI ESMAEILZADEH, and MOHAMMAD REZA ROSTAMI, Presenting the forecasting model of bitcoin return using the hybrid method of deep
learning-signal decomposition algorithm (ceemd-dl), (2023).
[33] Shadi Shahverdiani and Samiran Khajehzadeh, Analyzing fluctuations of stock prices of
the companies listed in tehran stock exchange using the machine learning method, Iranian
Economic Development Analyses 6 (2018), no. 1, 69–91.
[34] Amir Sharif Far, Maryam Khaliliaraghi, Iman Raeesi Vanani, and Mirfeyz Fallahshams, Application of deep learning architectures in stock price forecasting: A convolutional neural
network approach, Journal of Asset Management and Financing 10 (2022), no. 3, 1–20.
[35] Yong Shi, Wei Li, Luyao Zhu, Kun Guo, and Erik Cambria, Stock trading rule discovery with
double deep q-network, Applied Soft Computing 107 (2021), 107320.
[36] Pierre L Siklos, Central banks into the breach: from triumph to crisis and the road ahead,
Oxford University Press, 2017.
[37] Van-Dai Ta, CHUAN-MING Liu, and Direselign Addis Tadesse, Portfolio optimization-based
stock prediction using long-short term memory network in quantitative trading, Applied
Sciences 10 (2020), no. 2, 437.
[38] GJ Tsekouras, EN Dialynas, ND Hatziargyriou, and S Kavatza, A non-linear multivariable
regression model for midterm energy forecasting of power systems, vol. 77, Elsevier, 2007,
pp. 1560–1568.
[39] Milad Vazan, Deep learning: principles, concepts and approaches, Miad andishe (2021).
[40] Wuyu Wang, Weizi Li, Ning Zhang, and Kecheng Liu, Portfolio formation with preselection
using deep learning from long-term financial data, Expert Systems with Applications 143
(2020), 113042.
[41] Na Wu, Zongwu Ke, and Lei Feng, Stock price forecast based on lstm and ddqn, 2022 14th
International Conference on Advanced Computational Intelligence (ICACI), IEEE, 2022,
pp. 182–185.
[42] Yanru Xu, Zhengui Li, and Linkai Luo, A study on feature selection for trend prediction
of stock trading price, 2013 International Conference on Computational and Information
Sciences, IEEE, 2013, pp. 579–582.
[43] Xiao Zhong and David Enke, Predicting the daily return direction of the stock market using
hybrid machine learning algorithms, Financial Innovation 5 (2019), no. 1, 1–20.
[44] Mehdi Zolfaghari, Bahram Sahabi, and Mohamad Javad Bakhtyaran, Designing a model for
forecasting the stock exchange total index returns (emphasizing on combined deep learning
network models and garch family models), Financial Engineering and Portfolio Management
11 (2020), no. 42, 138–171.