Stock Price Index Prediction Using Random Forest Algorithm for Optimal Portfolio

  • Putri Humairah Universitas Negeri Padang, Indonesia
  • Dina Agustina Universitas Negeri Padang, Indonesia
Keywords: Machine Learning, Portfolio Optimal, Random Forest

Abstract

With a majority Muslim population in Indonesia, Islamic capital markets such as the Jakarta Islamic
Index (JII) are a relevant choice because the JII is an investment index that complies with Sharia principles. This research aims to predict stock prices in the JII using the Random Forest (RF) algorithm and
form an optimal portfolio with the Mean-Variance Efficient Portfolio (MVEP) model. The data used is
the daily closing price of JII stocks from April 2023 to March 2024, obtained from the Indonesia Stock
Exchange and Yahoo Finance. The RF method is used to predict stock prices, with model performance
evaluation using Mean Absolute Percentage Error (MAPE). The results showed that the application of
ML with the RF algorithm in predicting stock prices produced very good predictions because the evaluation results using MAPE were in the 0%-10% range, namely a value of 2.522% for ACES shares;
1.222% for ICBP shares, and 0.760% for INDF shares. The optimal portfolio formed using MVEP
produces a stock composition with a weight of 7.64% for ACES, 22.46% for ICBP, and 69.90% for
INDF. The optimal portfolio’s estimated expected return and risk are 0.0546% and 0.0103%.

References

Abraham, R., Samad, M., Bakhach, A., El-Chaarani, H., Sardouk, A., Nemar, S., & Jaber, D. (2022). Forecasting a Stock Trend
Using Genetic Algorithm and Random Forest. Journal of Risk and Financial Management, 15(5), 188. https://doi.org/
10.3390/jrfm15050188
Abubakar, R. (2021). Pengantar Metodologi Penelitian. SUKA-Press UIN Sunan Kalijaga.
Agustina, D., Fitri, F., Zilrahmi, Winanda, R. S., & Sari, D. P. (2024). Utilization of machine learning for predictive maintenance in
improving productivity in manufacturing industry. AIP Conference Proceedings, 3123(1), 060001. https://doi.org/10.
1063/5.0224329
Agustina, D., Sari, D. P., Winanda, R. S., Hilmi, M. R., & Fakhriyana, D. (2022). Comparison of Portfolio Mean-Variance Method
with the Mean-Variance-Skewness-Kurtosis Method in Indonesia Stocks. EKSAKTA: Berkala Ilmiah Bidang MIPA,
23(2), 88–97. https://doi.org/10.24036/eksakta/vol23-iss02/316
Ardesfira, G., Zedha, H. F., Fazana, I., Rahmadhiyanti, J., Rahima, S., & Anwar, S. (2022). Peramalan Nilai Tukar Rupiah terhadap
Dollar Amerika dengan Menggunakan Metode Autoregressive Integrated Moving Average (Arima) [Number: 2]. Jambura
Journal of Probability and Statistics, 3(2), 71–84. https://doi.org/10.34312/jjps.v3i2.15469
Arisena, A., Noviyanti, L., Soleh, A. Z., & Indrayatna, F. (2023). Return Portofolio Optimal dengan Pendekatan Single Index Model,
Treynor Black Model, Dan Black-Litterman Model [Number: 2]. VARIANCE: Journal of Statistics and Its Applications,
5(2), 117–130. https://doi.org/10.30598/variancevol5iss2page117-130
Atta Mills, E. F. E., Yan, D., Yu, B., & Wei, X. (2016). Research on regularized mean–variance portfolio selection strategy with
modified Roy safety-first principle. SpringerPlus, 5(1), 919. https://doi.org/10.1186/s40064-016-2621-7
Bastian, M. E., Rahayudi, B., & Ratnawati, D. E. (2021). Prediksi Trend Harga Saham Jangka Pendek berdasarkan Fitur Technical
Analysis dengan menggunakan Algoritma Random Forest [Number: 10]. Jurnal Pengembangan Teknologi Informasi
dan Ilmu Komputer, 5(10), 4536–4542. https://j-ptiik.ub.ac.id/index.php/j-ptiik/article/view/9945
Box, G. E. P., Jenkins, G. M., Reinsel, G. C., & Ljung, G. M. (2016). Time series analysis: Forecasting and control (Fifth
edition). Wiley.
Cholissodin, I., & Soebroto, A. (2019, July). Buku Ajar AI, Machine Learning & Deep Learning. Fakultas Ilmu Komputer
(FILKOM), Universitas Brawijaya (UB).
Desiyanti, R. (2017). Teori Investasi Dan Portofolio. Bung Hatta University Press.
Fadhila, S. N., & Zuliana, S. U. (2023). Optimasi Portofolio Saham Menggunakan Model Markowitz Berdasarkan Prediksi Harga
Saham. Kaunia: Integration and Interconnection Islam and Science Journal, 18(1), 35–40. https://doi.org/10.14421/
kaunia.3948
Geron, A. (2019). ´ Hands-on machine learning with Scikit-Learn, Keras, and TensorFlow: Concepts, tools, and techniques
to build intelligent systems (Second edition). O’Reilly.
Gunadi, N. L. D. S., & Widyatama, J. (2021). Perhitungan Sebagai Seorang Investor Saham Atas Besaran Pajak Yang Harus Dibayarkan Kepada Negara. Jurnal Locus Delicti, 2(1), 13–23. https://doi.org/10.23887/jld.v2i1.455
Hu, Z., Zhao, Y., & Khushi, M. (2021). A Survey of Forex and Stock Price Prediction Using Deep Learning. Applied System
Innovation, 4(1), 9. https://doi.org/10.3390/asi4010009
Ji, X., Wang, J., & Yan, Z. (2021). A stock price prediction method based on deep learning technology. International Journal of
Crowd Science, 5(1), 55–72. https://doi.org/10.1108/IJCS-05-2020-0012
Jogunuri, S., F.T, J., Stonier, A. A., Peter, G., Jayaraj, J., S, J., J, J. J., & Ganji, V. (2024). Random forest machine learning algorithm based seasonal multi-step ahead short-term solar photovoltaic power output forecasting. IET Renewable Power
Generation, rpg2.12921. https://doi.org/10.1049/rpg2.12921
Logubayom, A. I., & Victor, T. A. (2019). Portfolio Optimization of Some Stocks on the Ghana Stock Exchange Using the Markowitz
Mean-Variance Approach. Journal of Financial Risk Management, 08(01), 29–41. https://doi.org/10.4236/jfrm.2019.
81003
Mercurio, P. J., Wu, Y., & Xie, H. (2020). An Entropy-Based Approach to Portfolio Optimization. Entropy, 22(3), 332. https :
//doi.org/10.3390/e22030332
Pinelis, M., & Ruppert, D. (2022). Machine learning portfolio allocation. The Journal of Finance and Data Science, 8, 35–54.
https://doi.org/10.1016/j.jfds.2021.12.001
Putra, J. W. G. (2020). Pengenalan Konsep Pembelajaran Mesin dan Deep Learning (Edisi 1.4).
Rathi, V., Kshirsagar, M., & Ryan, C. (2024). Enhancing Portfolio Performance: A Random Forest Approach to Volatility Prediction
and Optimization. Proceedings of the 16th International Conference on Agents and Artificial Intelligence, 1278–
1285. https://doi.org/10.5220/0012464600003636
Rivalno, F., Murni, D., & Sriningsih, R. (2019). Portofolio Mean Variance Efficient Dua Konstrain Pada 15 Saham Indeks LQ45.
Journal of Mathematics UNP, 4(1).
Tyralis, H., & Papacharalampous, G. (2017). Variable Selection in Time Series Forecasting Using Random Forests. Algorithms,
10(4), 114. https://doi.org/10.3390/a10040114
Wang, L., Ahmad, F., Luo, G.-l., Umar, M., & Kirikkaleli, D. (2022). Portfolio optimization of financial commodities with energy
futures. Annals of Operations Research, 313(1), 401–439. https://doi.org/10.1007/s10479-021-04283-x
Yin, L., Li, B., Li, P., & Zhang, R. (2023). Research on stock trend prediction method based on optimized random forest. CAAI
Transactions on Intelligence Technology, 8(1), 274–284. https://doi.org/10.1049/cit2.12067
Published
2024-11-25
How to Cite
[1]
P. Humairah and D. Agustina, “Stock Price Index Prediction Using Random Forest Algorithm for Optimal Portfolio”, Jurnal Varian, vol. 8, no. 1, pp. 113 - 124, Nov. 2024.
Section
Articles