Application of Agglomerative Hierarchical Clustering Based on Rolling Horizon and Minimum Variance in IDX30 Stock Portfolio Optimization

Authors

  • Khoirunnisa Puspa Negari Universitas Negeri Yogyakarta
  • Ezra Putranda Setiawan a:1:{s:5:"en_US";s:65:"Department of Mathematics Education Universitas Negeri Yogyakarta";}

DOI:

https://doi.org/10.20956/wm9n6k43

Keywords:

Agglomerative Hierarchical Clustering, IDX30, Optimization Portfolio, Rolling Window

Abstract

Portfolio diversification is a strategy to reduce investment risk by spreading assets across stocks with different movement patterns. However, most investors tend to select stocks based on highest historical returns and exhibit herding behavior without considering inter-stock correlations, risking undiversified portfolios. Stock movement patterns are dynamic, requiring methods that accommodate such changes. This study aims to cluster IDX30 stocks using agglomerative hierarchical clustering based on rolling horizon to identify stocks with relatively consistent movement patterns, compare diversification characteristics, and evaluate portfolio performance using minimum variance and equal weight. Data consists of daily closing prices of IDX30 stocks from January 3, 2022 to December 30, 2024 obtained from Yahoo Finance. Results show stocks tend to cluster based on sectoral similarity with cluster membership proportion of  for  and  for . Horizons 5 and 12 were selected as portfolio construction periods due to having the highest number of consistent stocks. Clustering portfolios exhibit better diversification with more low-correlated stock pairs compared to non-clustering portfolios. Minimum variance optimization shows the  clustering portfolio outperforms with Sharpe ratios of  at horizon 5 and  at horizon 12 compared to  and non-clustering portfolios. Conversely, equal weight shows non-clustering portfolios outperform clustering portfolios. During the evaluation period, the  clustering portfolio with minimum variance achieved average returns of  for 30 days and  for 60 days after horizon 5 and demonstrated relatively stable performance under extreme market conditions at horizon 12.

References

[1] Akkaya, M., 2021. Behavioral portfolio theory. In: Applying Particle Swarm Optimization. Cham: Springer. pp.29–48. https://doi.org/10.1007/978-3-030-70281-6_3.

[2] Badan Kebijakan Fiskal Kemenkeu, 2024. Laporan ekonomi dan keuangan mingguan selama bulan Agustus-September 2024. [online] Available at: <https://fiskal.kemenkeu.go.id/analisis/laporan-ekonomi-dan-keuangan-mingguan?date=2024-08-01> [Accessed 5 January 2026].

[3] Baek, C., 2016. Stock prices, dividends, earnings, and investor sentiment. Review of Quantitative Finance and Accounting, 47(4), pp.1043–1061. https://doi.org/10.1007/s11156-015-0530-4.

[4] Ballal, T., Abdelrahman, S., Muqaibel, A.H. and Al-Naffouri, T.Y., 2021. An adaptive regularization approach to portfolio optimization. In: International Conference on Acoustics, Speech and Signal Processing. Toronto: IEEE. pp.5175–5179. https://doi.org/10.1109/ICASSP39728.2021.9413865.

[5] Budiman, J., Limgestu, R., Alvin, A., Nopry, N. and Sagianto, I.T., 2023. Perilaku pengambilan keputusan investasi investor pasar saham Indonesia. Fair Value: Jurnal Keuangan dan Investasi, [online] 5(9), pp.3518–3526. Available at: <https://journal.ikopin.ac.id/index.php/fairvalue/article/view/2812>.

[6] Bursa Efek Indonesia, 2025a. Fact book index IDX30 by November 2025. [online] Available at: <https://www.idx.co.id/id/data-pasar/laporan-statistik/fact-sheet-index/> [Accessed 24 December 2025].

[7] Bursa Efek Indonesia, 2025b. Press release: Jumlah investor pasar modal Indonesia tembus 20 juta. [online] Available at: <https://www.idx.co.id/id/berita/siaran-pers/2525> [Accessed 24 December 2025].

[8] Clarke, R., De Silva, H. and Thorley, S., 2011. Minimum-variance portfolio composition. Journal of Portfolio Management, 37(2), pp.31–45. https://doi.org/10.3905/jpm.2011.37.2.031.

[9] DeMiguel, V., Garlappi, L. and Uppal, R., 2009. Optimal versus naive diversification: How inefficient is the 1/N portfolio strategy? Review of Financial Studies, 22(5), pp.1915–1953. https://doi.org/10.1093/rfs/hhm075.

[10] Gatta, F., Iorio, C., Chiaro, D., Giampaolo, F. and Cuomo, S., 2023. Statistical arbitrage in the stock markets by the means of multiple time horizons clustering. Neural Computing and Applications, 35(16), pp.11713–11731. https://doi.org/10.1007/s00521-023-08313-6.

[11] Guan, H.S. and Jiang, Q.S., 2007. Cluster financial time series for portfolio. In: Proceedings of International Conference on Wavelet Analysis and Pattern Recognition. Beijing: IEEE. pp.851–856. https://doi.org/10.1109/ICWAPR.2007.4420788.

[12] Gubu, L., Rosadi, D. and Abdurakhman, 2019. Classical portfolio selection with cluster analysis: comparison between hierarchical complete linkage and ward algorithm. In: SEAMS-UGM International Conference on Mathematics and its Applications. Yogyakarta: AIP Publishing. pp.1–7. https://doi.org/10.1063/1.5139174.

[13] Hwang, J.K., 2012. Dynamic correlation analysis of Asian stock markets. International Advances in Economic Research, 18(2), pp.227–237. https://doi.org/10.1007/s11294-012-9343-6.

[14] Inrawan, A., Hastutik, S., Tonnis, B., Nugroho, H., Manik, E., Indriani, S., Hamdana, H., Salam, A., Atika, A., Kusumaningsih, A., Mindosa, B., Wijayangka, C., Djuanda, G. and Firmansyah, H., 2022. Portofolio dan investasi. 1st ed. Bandung: Widina Bhakti Persada.

[15] Lin, F.L., Yang, S.Y., Marsh, T. and Chen, Y.F., 2018. Stock and bond return relations and stock market uncertainty: Evidence from wavelet analysis. International Review of Economics and Finance, 55, pp.285–294. https://doi.org/10.1016/j.iref.2017.07.013.

[16] Longin, F. and Solnik, B., 2001. Extreme correlation of international equity markets. Journal of Finance, 56(2), pp.649–676. https://doi.org/10.1111/0022-1082.00340.

[17] Malabaguio, A.L., Pimentel, R.L.G., Zaballero, A.M.M. and Go, C.K., 2024. Dynamic portfolio optimization according to market states and diversification using hierarchical clustering. In: International Conference on Applied & Industrial Mathematics and Statistics. Pahang: AIP Publishing. pp.1–9. https://doi.org/10.1063/5.0213407.

[18] Manh, T.N. and Quoc, H.B., 2024. Portfolio construction based on time series clustering method evidence in the Vietnamese stock market. In: M.H. Hà, X. Zhu and M.T. Thai, eds. Computational Data and Social Networks. Singapore: Springer. pp.129–137. https://doi.org/10.1007/978-981-97-0669-3_13.

[19] Mantegna, R.N., 1999. Hierarchical structure in financial markets. The European Physicial Journal B - Condensed Matter and Complex Systems, 11, pp.193–197. https://doi.org/10.1007/s100510050929.

[20] Markowitz, H., 1952. Portfolio selection. The Journal of Finance, 7(1), pp.77–91. https://doi.org/10.1111/j.1540-6261.1952.tb01525.x.

[21] Musmeci, N., Aste, T. and Matteo, T. Di, 2015. Relation between financial market structure and the real economy: Comparison between clustering methods. PLoS ONE, 10(3), pp.1–24. https://doi.org/10.1371/journal.pone.0116201.

[22] Otoritas Jasa Keuangan, 2024. Fact book pasar modal, keuangan derivatif, dan bursa karbon. [online] Indonesia. Available at: <https://ojk.go.id/id/Statistik/Pasar-Modal/Laporan-Tahunan/Pages/Fact-Book-Pasar-Modal,-Keuangan-Derivatif,-dan-Bursa-Karbon-(PMDK)-2024.aspx>.

[23] Oyenubi, A., 2019. Diversification measures and the optimal number of stocks in a portfolio: An information theoretic explanation. Computational Economics, 54(4), pp.1443–1471. https://doi.org/10.1007/s10614-016-9600-5.

[24] Palomar, D.P., 2025. Portfolio optimization: Theory and application. Hong Kong: Cambridge University Press. https://doi.org/10.1017/9781009428095.

[25] Raffinot, T., 2018. Hierarchical clustering-based asset allocation. The Journal of Portfolio Management, 44(2), pp.89–99. https://doi.org/10.3905/jpm.2018.44.2.089.

[26] Sathya, N. and Gayathiri, R., 2024. Behavioral biases in investment decisions: An extensive literature review and pathways for future research. Journal of Information and Organizational Sciences, 48(1), pp.117–131. https://doi.org/10.31341/jios.48.1.6.

[27] Siska, E., Duraipandi, O. and Widodo, P., 2023. Determinants of Indonesian stock market development: Implementation of an ARDL bound testing approach. Investment Management and Financial Innovations, 20(4), pp.69–82. https://doi.org/10.21511/imfi.20(4).2023.07.

[28] Tang, W., Xu, X. and Zhou, X.Y., 2022. Asset selection via correlation blockmodel clustering. Expert Systems with Applications, 195(1), pp.1–23. https://doi.org/10.1016/j.eswa.2022.116558.

[29] Tangsripairoj, S., Lertkulthum, V., Xie, L. and Yang, Y., 2023. Stock plenty: A web application for virtual stock trading. In: International Conference on Information Technology. Chiang Rai: IEEE. pp.192–197. https://doi.org/10.1109/InCIT60207.2023.10412859.

[30] Tola, V., Lillo, F., Gallegati, M. and Mantegna, R.N., 2008. Cluster analysis for portfolio optimization. Journal of Economic Dynamics and Control, 32(1), pp.235–258. https://doi.org/10.1016/j.jedc.2007.01.034.

[31] Tumminello, M., Lillo, F. and Mantegna, R.N., 2010. Correlation, hierarchies, and networks in financial markets. Journal of Economic Behavior & Organization, 75(1), pp.40–58. https://doi.org/10.1016/j.jebo.2010.01.004.

[32] Wang, L., Lu, Z. and Ren, Y., 2019. A rolling horizon approach for production planning and condition-based maintenance under uncertain demand. Journal of Risk and Reliability, 233(6), pp.1014–1028. https://doi.org/10.1177/1748006X19853671.

[33] Yue, S., Wang, X. and Wei, M., 2008. Application of two-order difference to gap statistic. Transactions of Tiajin University, 14, pp.217–221. https://doi.org/10.1007/s12209-008-0039-1.

[34] Yusuf, R., Handari, B. and Hertono, G., 2019. Implementation of agglomerative clustering and genetic algorithm on stock portfolio optimization with possibilistic constraints. In: International Symposium on Current Progress in Mathematics and Sciences. Depok: AIP Publishing. pp.1–7. https://doi.org/10.1063/1.5132455.

[35] Zhang, J. and Maringer, D., 2011. Distributing weights under hierarchical clustering: A way in reducing performance breakdown. Expert Systems with Applications, 38(12), pp.14952–14959. https://doi.org/10.1016/j.eswa.2011.05.052.

[36] Zivot, E., 2002. Introduction to computational finance and financial econometrics. Washington: University of Washington.

Downloads

Published

2026-09-15

Issue

Section

Research Articles

How to Cite

Application of Agglomerative Hierarchical Clustering Based on Rolling Horizon and Minimum Variance in IDX30 Stock Portfolio Optimization. (2026). Jurnal Matematika, Statistika Dan Komputasi, 23(1), 94-110. https://doi.org/10.20956/wm9n6k43

Most read articles by the same author(s)