Selection and multi-objective optimisation of stock portfolio using a combination of machine learning methods and meta-heuristic algorithms

Document Type : Original Article


1 Phd Student, Department of financial management, science and research branch, Islamic Azad university, tehran, iran

2 Assistant Professor, Department of Information Technology Management, Electronic branch, Islamic Azad university, tehran, iran

3 Assistant Professor, Department of Financial Management, Electronic branch, Islamic Azad University, Tehran, Iran


The main goal the model and optimal investment portfolio selection to maximize stock portfolio returns based on the forecasted price and minimize investment portfolio risk based on the Markowitz model. This paper presents is to select the optimal stock portfolio based on data training through Markov decision-making and ensemble learning. To teach data from the data of five years (2016-2011), 85 active stock exchange companies in Iran that have been filtered based on technical, fundamental, and time series variables have been used. Therefore, the stock sets are first filtered based on optimizing trading rules based on technical analysis, Markov decision-making and ensemble learning that issued the buy signal. Data for the next 5 years (2020-2016) were also used to test NSGA II and MOPSO algorithms. According to the obtained results, if the shares are bought equally among 85 companies and maintained for five years, the average return on the total stock portfolio is equal to 13.08%, with a risk of 0.946%. While using the MOPSO algorithm has achieved an average of 43.54% with an average risk of 1.102% . The rate of return on capital for the NSGA II algorithm was also the highest in 5 years. Therefore, it can be said that based on the obtained indicators, NSGA II algorithm is the best combination of the stock portfolio.


  • Abounoori, E., Elmi, Z. M., & Nademi, Y. (2016). Forecasting Tehran stock exchange volatility; Markov switching GARCH approach. Physica A: Statistical Mechanics and its Applications, 445, 264-282.
  • Aldrich, H. E. (2014, August). The democratization of entrepreneurship? Hackers, makerspaces, and crowdfunding. In Annual meeting of the academy of management (Vol. 10, pp. 1-7).
  • Andersson, T. D., Getz, D., & Jutbring, H. (2020). Balancing value and risk within a city's event portfolio: an explorative study of DMO professionals' assessments. International Journal of Event and Festival Management.
  • Andersson, T. D., Getz, D., & Jutbring, H. (2020). Balancing value and risk within a city's event portfolio: an explorative study of DMO professionals' assessments. International Journal of Event and Festival Management.

  • Anwar, M., & Rahman, S. (2019). Forecasting stock market prices using advanced tools of machine learning (Doctoral dissertation, Brac University).
  • Ballings, M., Van den Poel, D., Hespeels, N., & Gryp, R. (2015). Evaluating multiple classifiers for stock price direction prediction. Expert systems with Applications, 42(20), 7046-7056.
  • Basak, S., Kar, S., Saha, S., Khaidem, L., & Dey, S. R. (2019). Predicting the direction of stock market prices using tree-based classifiers. The North American Journal of Economics and Finance, 47, 552-567.
  • Bigerna, Simona, Carlo Andrea Bollino, and Philipp Galkin. "Balancing energy security priorities: portfolio optimization approach to oil imports." Applied Economics 53.5 (2021): 555-574.
  • Bolton, P., Chen, H., & Wang, N. (2013). Market timing, investment, and risk management. Journal of Financial Economics, 109(1), 40-62.
  • Chang, Y. H., & Lee, M. S. (2017). Incorporating Markov decision process on genetic algorithms to formulate trading strategies for stock markets. Applied Soft Computing, 52, 1143-1153.
  • Chavan, P. S., & Patil, S. T. (2013). Parameters for stock market prediction. International Journal of Computer Technology and Applications, 4(2), 337.
  • Chen, Y., & Hao, Y. (2017). A feature weighted support vector machine and K-nearest neighbor algorithm for stock market indices prediction. Expert Systems with Applications, 80, 340-355.
  • Cheng, C. H., Chen, T. L., & Wei, L. Y. (2010). A hybrid model based on rough sets theory and genetic algorithms for stock price forecasting. Information Sciences, 180(9), 1610-1629.
  • Chiu, D. Y., & Chian, S. Y. (2010, August). Exploring stock market dynamism in multi-nations with genetic algorithm, support vector regression, and optimal technical analysis. In The 6th International Conference on Networked Computing and Advanced Information Management (pp. 694-699). IEEE.
  • Chowdhury, R., Mahdy, M. R. C., Alam, T. N., Al Quaderi, G. D., & Rahman, M. A. (2020). Predicting the stock price of frontier markets using machine learning and modified Black–Scholes Option pricing model. Physica A: Statistical Mechanics and its Applications, 555, 124444.
  • Dastkhan, H., Gharneh, N. S., & Golmakani, H. (2011). A linguistic-based portfolio selection model using weighted max–min operator and hybrid genetic algorithm. Expert Systems with Applications, 38(9), 11735-11743.
  • Dietterich, T. G. (2002). Ensemble learning. The handbook of brain theory and neural networks, 2(1), 110-125.
  • dos Santos, D. C., de Souza, A. D., & Mota, F. B. (2021). Techniques and Tools for Selection and Strategic Alignment of Projects and Projects Portfolio Balancing: A Systematic Mapping. In ITNG 2021 18th International Conference on Information Technology-New Generations (pp. 195-201). Springer, Cham.
  • Du, P., Luo, X., He, Z., & Xie, L. (2010, May). The application of genetic algorithm-radial basis function (ga-rbf) neural network in stock forecasting. In 2010 Chinese Control and Decision Conference (pp. 1745-1748). IEEE.
  • Fallah, M., & Nozari, H. (2021). Neutrosophic Mathematical Programming for Optimization of Multi-Objective Sustainable Biomass Supply Chain Network Design. CMES-COMPUTER MODELING IN ENGINEERING & SCIENCES.
  • Fama, E. F. (2021). Efficient capital markets a review of theory and empirical work. The Fama Portfolio, 76-121.
  • Fischer, T., & Krauss, C. (2018). Deep learning with long short-term memory networks for financial market predictions. European Journal of Operational Research, 270(2), 654-669.
  • Ghahremani Nahr, J. (2020). Improvement the efficiency and efficiency of the closed loop supply chain: Whale optimization algorithm and novel priority-based encoding approach. Journal of Decisions and Operations Research, 4(4), 299-315.
  • Ghahremani-Nahr, J., Nozari, H., & Sadeghi, M. E. (2021). Investment modeling to study the performance of dynamic networks of insurance companies in Iran. Modern Research in Performance Evaluation.
  • Ghezzi, L. L., & Piccardi, C. (2003). Stock valuation along a Markov chain. Applied mathematics and computation, 141(2-3), 385-393.
  • Glantz, M., & Kissell, R. L. (2013). Multi-asset risk modeling: techniques for a global economy in an electronic and algorithmic trading era. Academic Press.
  • Gold, S. C., & Lebowitz, P. (1999). Computerized stock screening rules for portfolio selection. Financial services review, 8(2), 61-70.
  • Hassan, M. R. (2009). A combination of hidden Markov model and fuzzy model for stock market forecasting. Neurocomputing, 72(16-18), 3439-3446.
  • Hsiao, C., & Shen, Y. (2003). Foreign direct investment and economic growth: the importance of institutions and urbanization. Economic development and Cultural change, 51(4), 883-896.
  • Hsu, Y. T., Liu, M. C., Yeh, J., & Hung, H. F. (2009). Forecasting the turning time of stock market based on Markov–Fourier grey model. Expert Systems with Applications, 36(4), 8597-8603.
  • Huang, Y. (2019). Machine learning for stock prediction based on fundamental analysis.
  • Jahed Armaghani, D., Kumar, D., Samui, P., Hasanipanah, M., & Roy, B. (2021). A novel approach for forecasting of ground vibrations resulting from blasting: modified particle swarm optimization coupled extreme learning machine. Engineering with computers, 37(4), 3221-3235.
  • Jang, G., Lai, F., & Parng, T. (1993). Intelligent stock trading decision support system using dual adaptive-structure neural networks. Journal of Information Science and Engineering, 9(2), 271-297.
  • Jasic, T., & Wood, D. (2004). The profitability of daily stock market indices trades based on neural network predictions: Case study for the S&P 500, the DAX, the TOPIX and the FTSE in the period 1965–1999. Applied Financial Economics, 14(4), 285-297.
  • Jiang, M., Liu, J., Zhang, L., & Liu, C. (2020). An improved Stacking framework for stock index prediction by leveraging tree-based ensemble models and deep learning algorithms. Physica A: Statistical Mechanics and its Applications, 541, 122272.
  • Jung, E., Kim, J., Kim, M., Jung, D. H., Rhee, H., Shin, J. M.,... & Choi, S. H. (2007). Artificial neural network models for prediction of intestinal permeability of oligopeptides. BMC bioinformatics, 8(1), 1-9.
  • Kara, Y., Boyacioglu, M. A., & Baykan, Ö. K. (2011). 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, 38(5), 5311-5319.
  • Khan, A. U., Bandopadhyaya, T. K., & Sharma, S. (2008). Genetic algorithm based backpropagation neural network performs better than backpropagation neural network in stock rates prediction. International Journal of Computer Science and Network Security, 8(7), 162-166.
  • Khedmati, M., & Azin, P. (2020). An online portfolio selection algorithm using clustering approaches and considering transaction costs. Expert Systems with Applications, 159, 113546.
  • Kim, K. A., & Nofsinger, J. R. (2008). Behavioral finance in Asia. Pacific-Basin Finance Journal, 16(1-2), 1-7.
  • Kimoto, T., Asakawa, K., Yoda, M., & Takeoka, M. (1990, June). Stock market prediction system with modular neural networks. In 1990 IJCNN international joint conference on neural networks (pp. 1-6). IEEE.
  • Ko, P. C., Lin, P. C., & Tsai, Y. T. (2007, September). A nonlinear stock valuation using a hybrid model of genetic algorithm and cubic spline. In Second International Conference on Innovative Computing, Informatio and Control (ICICIC 2007) (pp. 210-210). IEEE.
  • Lazo, J. G., Vellasco, M. M., & Pacheco, M. A. C. (2000, July). A hybrid genetic-neural system for portfolio selection and management. In Proceedings of the Sixth International Conference on Engineering Applications of Neural Networks (pp. 17-19).
  • Leu, Y., & Chiu, T. I. (2011, October). An effective stock portfolio trading strategy using genetic algorithms and weighted fuzzy time series. In The 16th North-East Asia Symposium on Nano, Information Technology and Reliability (pp. 70-75). IEEE.
  • Liao, Z., & Wang, J. (2010). Forecasting model of global stock index by stochastic time effective neural network. Expert Systems with Applications, 37(1), 834-841.
  • Lipinski, P. (2008, September). Neuro-evolutionary Decision Support System for Financial Time Series Analysis. In International Workshop on Hybrid Artificial Intelligence Systems (pp. 180-187). Springer, Berlin, Heidelberg.
  • Lo, A. W., Mamaysky, H., & Wang, J. (2000). Foundations of technical analysis: Computational algorithms, statistical inference, and empirical implementation. The journal of finance, 55(4), 1705-1765.
  • Malik, H., Alotaibi, M. A., & Almutairi, A. (2021). A new hybrid model combining EMD and neural network for multi-step ahead load forecasting. Journal of Intelligent & Fuzzy Systems, (Preprint), 1-16.
  • Malkiel, B. G. (2003). The efficient market hypothesis and its critics. Journal of economic perspectives, 17(1), 59-82.
  • Mandelbrot, B., & Hudson, R. L. (2004). A fractal view of risk, ruin and reward
  • Montier, J. (2009). Behavioural investing: a practitioner's guide to applying behavioural finance. John Wiley & Sons.
  • Nahr, J. G., Bathaee, M., Mazloumzadeh, A., & Nozari, H. (2021). Cell Production System Design: A Literature Review. International Journal of Innovation in Management, Economics and Social Sciences, 1(1), 16-44.
  • Ng, H. S., Lam, K. P., & Lam, S. S. (2003, March). Incremental genetic fuzzy expert trading system for derivatives market timing. In 2003 IEEE International Conference on Computational Intelligence for Financial Engineering, 2003. Proceedings. (pp. 421-427). IEEE.
  • Oh, K. J., Kim, T. Y., Min, S. H., & Lee, H. Y. (2006). Portfolio algorithm based on portfolio beta using genetic algorithm. Expert Systems with Applications, 30(3), 527-534.
  • Óskarsson, M. (2021). Back-testing portfolio risk management strategies (Doctoral dissertation).
  • Óskarsson, M. (2021). Back-testing portfolio risk management strategies (Doctoral dissertation).
  • 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.
  • Pungetmongkol, S., Nantajeewarawat, E., Ploykitikoon, P., & Tanwanont, P. (2020, June). Portfolio Management in Different Market Trends for Thai Mutual Funds. In 2020 17th International Conference on Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology (ECTI-CON) (pp. 527-530). IEEE.
  • Quek, C., Yow, K. C., Cheng, P. Y., & Tan, C. C. (2009). Investment portfolio balancing: application of a generic self‐organizing fuzzy neural network (GenSoFNN). Intelligent Systems in Accounting, Finance & Management: International Journal, 16(1‐2), 147-164.
  • Salman, A. D., Mata, B. A. K., Kurfi, A. K., & Ado, A. B. (2020). The relationship between the investment portFfoLlio and namking financial pRrformance in Nigeria. Asian people Journal (APJ), 3(1), 141-151.
  • Sefiane, S., & Benbouziane, M. (2012). Portfolio selection using genetic algorithm.
  • Shoaf, J., & Foster, J. A. (1998, May). The efficient set GA for stock portfolios. In 1998 IEEE International Conference on Evolutionary Computation Proceedings. IEEE World Congress on Computational Intelligence (Cat. No. 98TH8360) (pp. 354-359). IEEE.
  • Strader, T. J., Rozycki, J. J., Root, T. H., & Huang, Y. H. J. (2020). Machine learning stock market prediction studies: Review and research directions. Journal of International Technology and Information Management, 28(4), 63-83.
  • Tan, T. Z., Quek, C., Ng, G. S., & Ng, E. Y. K. (2007). A novel cognitive interpretation of breast cancer thermography with complementary learning fuzzy neural memory structure. Expert Systems with Applications, 33(3), 652-666.
  • TW, A., Dineen, C. R., Solvason, D. L., & Hsiao, C. (2012). Econometric Modelling of Canadian Long Distance Calling: A Comparison of Aggregate Time Series Versus Point-to-Point Panel Data Approaches. Panel Data Analysis, 125.
  • Versace, M., Bhatt, R., Hinds, O., & Shiffer, M. (2004). Predicting the exchange traded fund DIA with a combination of genetic algorithms and neural networks. Expert systems with applications, 27(3), 417-425.
  • Wang, Z., Huang, B., Tu, S., Zhang, K., & Xu, L. (2021, May). DeepTrader: A Deep Reinforcement Learning Approach for Risk-Return Balanced Portfolio Management with Market Conditions Embedding. In Proceedings of the AAAI Conference on Artificial Intelligence (Vol. 35, No. 1, pp. 643-650).
  • Yeh, C. Y., Huang, C. W., & Lee, S. J. (2011). A multiple-kernel support vector regression approach for stock market price forecasting. Expert Systems with Applications, 38(3), 2177-2186.
  • Yiwen, Y., Guizhong, L., & Zongping, Z. (2000, March). Stock market trend prediction based on neural networks, multiresolution analysis and dynamical reconstruction. In Proceedings of the IEEE/IAFE/INFORMS 2000 Conference on Computational Intelligence for Financial Engineering (CIFEr)(Cat. No. 00TH8520) (pp. 155-156). IEEE.
  • Yu, L., Chen, H., Wang, S., & Lai, K. K. (2008). Evolving least squares support vector machines for stock market trend mining. IEEE transactions on evolutionary computation, 13(1), 87-102.
  • Zhou, Z. H. (2021). Ensemble learning. In Machine Learning (pp. 181-210). Springer, Singapore.