Guide to Investing in the Tehran Stock Exchange: The Application of Machine Learning in Technical Analysis Strategies

Authors
Urmia University
Abstract
Objective: The aim of this research is to provide a practical guide for investing in the Tehran Stock Exchange by combining technical analysis techniques with advanced machine learning methods. Focusing on the analysis of buy and sell signals in selected indices of the Tehran Stock Exchange, the study seeks to evaluate the effectiveness of machine learning models in predicting market trends.

Materials and Methods: In this study, the daily data of six selected indices of the Tehran Stock Exchange, including financial, petroleum products, automotive, pharmaceutical, food, and basic metals indices, were analyzed from 2020 to January 2025. Four machine learning models, including Linear Model, Random Forest, Artificial Neural Network, and Support Vector Regression, were utilized alongside two technical analysis strategies, TEMA and MACD, to generate and evaluate buy and sell signals.

Results: The results indicated that machine learning models, particularly Random Forest and Artificial Neural Network, performed better in identifying buy and sell signals when combined with TEMA and MACD strategies. These models were able to predict market trends with higher accuracy, and the signals they generated were mostly consistent with actual price changes. The food, automotivation and financial and basic metals indices demonstrated greater sensitivity to these analyses.

Conclusion: The combination of machine learning methods with technical analysis strategies can provide investors with a powerful tool for decision-making in the Tehran Stock Exchange. This research demonstrated that using these methods can not only improve the accuracy of buy and sell signals but also reduce investment risk and increase returns. Utilizing these models can be recommended as part of an investment strategy for analysts and investors.

Originality: This research is the first quantitative study that seeks to conceptualize buy and sell signals using the combined method of machine learning and technical analysis as one of the basic tools to guide investors.
Keywords

Afshari Rad, Elham, Alavi, Seyyed Anait Elah, and Sinaii, Hassan Ali. (2017). An intelligent model for predicting stock trends using technical analysis methods. Financial Research, 20(2), 249-264. (in Persian)
Ayyildiz, N., & Iskenderoglu, O. (2024). How effective is machine learning in stock market predictions?. Heliyon, 10(2).‌
Gholamian, Elham; Davoudi, Mohammadreza (2017). Forecasting the price trend in the stock market using random forest algorithm. Journal of Financial Engineering and Securities Management, (9) 35, 322-301. (in Persian)
Heaton, J. B., Polson, N. G., & Witte, J. H. (2017). Deep learning for finance: deep portfolios. Applied Stochastic Models in Business and Industry, 33(1), 3-12.
Heydari (2023). Stock trading strategy based on regression learning algorithms. Capital Market Analysis Quarterly, 3(2), 59-83. (in Persian)
Hosseini, Sayeda Atefeh; Aboui Mehrizi, Munira and Helvai, Javad; Shahtahmasbi, Esmail and Varan, Ramin. (2015). Fundamental analysis of stocks using two-stage hedging analysis. Financial engineering and securities management, 22, 95- 108. (in Persian)
Khan, W., Ghazanfar, M. A., Azam, M. A., Karami, A., Alyoubi, K. H., & Alfakeeh, A. S. (2022). Stock market prediction using machine learning classifiers and social media, news. Journal of Ambient Intelligence and Humanized Computing, 1-24.‌
Mehtab, S., Sen, J., & Dutta, A. (2021). Stock price prediction using machine learning and LSTM-based deep learning models. In Machine Learning and Metaheuristics Algorithms, and Applications: Second Symposium, SoMMA 2020, Chennai, India, October 14–17, 2020, Revised Selected Papers 2 (pp. 88-106). Springer Singapore.
Meyers, T. (2011). The Technical Analysis Course: Learn How to Forecast and Time the Market. McGraw Hill Professional.‌
Najem, R., Bahnasse, A., & Talea, M. (2024). Toward an Enhanced Stock Market Forecasting with Machine Learning and Deep Learning Models. Procedia Computer Science, 241, 97-103.‌
Patel, J., Shah, S., Thakkar, P., & Kotecha, K. (2015). Predicting stock and stock price index movement using trend deterministic data preparation and machine learning techniques. Expert systems with applications, 42(1), 259-268.‌
Saberi, Erfan, Radmand, Elnaz, Pirgezi, Jamshid and Kermani, Ali. (2023). Buying and selling strategy in the Iranian stock market using machine learning models along with feature selection using the cuckoo search algorithm. Soft computing. (in Persian)
Shahrabadi, Abolfazl. Bashiri, Neda (2010) Investment management in the stock exchange. Tehran: Stock Exchange Organization Publications;2015. (in Persian)
Tehrani R., Modares A., Tahriri A. (2010) "Investigation of Technical analysis indexes on stockholder return", Economics Researches, No. 92, pp. 23-46. (in Persian)
White, H. (1988). Economic prediction using neural networks: The case of IBM daily stock returns. Proceedings of the IEEE International conference on Neural Networks. 2, 451-458.