1. Introduction
When selecting stocks in portfolio design, diversification should be carried out to manage investment risk wisely [
1]. Stock diversification is a stock selection activity based on classifying different characteristics from different clusters. By selecting stocks in different clusters, the returns from the stocks in the portfolio are not highly correlated. It creates a return balance, where if one stock in the portfolio experiences a decline, the potential loss can be offset by positive performance stock in other clusters. In detail, it not only protects against losses but also increases the potential for stable and sustainable returns [
2]. Apart from diversification through clustering, analyzing the timing of buying and selling stocks is also important in selecting stocks in portfolio design [
3]. The stocks chosen should have buy indications so that the risk of loss can be minimized in the future. Analysis of when to buy and sell stocks can be conducted using daily price data or based on company fundamentals. After the selection of stocks in portfolio design is conducted, the next step is determining the capital weight of each stock within it. Stocks with a large mean of return are not always given a large capital weight, and vice versa. This is because it must be remembered that the mean and variance of returns have in-line properties [
4]. Thus, this weighting needs to be conducted carefully. The weighting of stock capital in a portfolio should be carried out based on basic investment objectives, namely maximizing returns and minimizing the risk of loss.
Several studies have discussed the mechanism of stock selection using clusterization. Chen and Huang [
5] introduced a clustering-based stock selection mechanism using the K-means algorithm, focusing on attributes such as average return, standard deviation of returns, Treynor index, and turnover rate. Sinha et al. [
6] used a genetic algorithm to cluster stocks. Golosnoy and Okhrin [
7] developed a mean-variance model involving shrinkage. Ren et al. [
8] applied the K-means algorithm to cluster stocks with attribute correlation coefficients. Fleischhacker et al. [
9] clustered stock data in the energy sector using the K-means algorithm with the attributes of heat demand, electricity demand, cooling demand, solar PV supply, and solar thermal collector supply. Using the average linkage algorithm and the distinctive features of the correlation coefficient between stock returns, Tola et al. [
10] grouped stock data. Musmeci et al. [
11] compared the K-medoids, linkage, and directed bubble hierarchical tree approaches using the correlation coefficient attributes of stocks. Hussain et al. [
12] proposed two novel methods, namely the Adaptive Neuro-Fuzzy Inference System (ANFIS) and the Induced Ordered Weighted Averaging (IOWA) model, for cluster stocks. Chen et al. [
13] and Cheong et al. [
14] employed the K-means technique to cluster stock data based on the average return attribute. Khan and Mehlawat [
15] employed fuzzy C-means clustering to group stocks into clusters. Then, Sáenz [
16] investigated the application of clustering models for stocks to enhance the accuracy of stock price predictions and the performance of trading algorithms.
Meanwhile, several researchers have also analyzed stock price movements. Navarro et al. [
17] conducted a price analysis using the moving average convergence–divergence (MACD) approach. Aheer et al. [
18] examined price fluctuations using geometric Brownian motion. Subsequently, Sukono et al. [
19] analyzed the stock price fluctuations using the ARIMA-GARCH model. Subsequently, Du and Tanaka-Ishii [
20] analyzed the movement of stock prices using NEWS-STock space with Event Distribution (NESTED). Chang et al. [
21] analyzed price fluctuations using behavioral stock (B-stock). Varga-Haszonits and Kondor [
22] examined the price movement, assuming it adheres to the constant conditional correlation GARCH process model provided by Bollerslev. Thuankhonrak et al. [
23] conducted a price analysis using the ARIMA and Holt Winter techniques.
Then, in capital weighting, Markowitz [
24] introduced the mean-variance capital weighting model in portfolios, which was later transformed into a matrix form for better computing efficiency by Sharpe [
25]. This model became the basis for future research, including the capital asset pricing model (CAPM) by Sharpe [
26] and the minimax portfolio model by Young [
27]. Other researchers have developed models for risk aversion by Björk et al. [
28], portfolio mean-variance-skewness by Abdurakhman [
29], equilibrium optimizer by Faramarzi et al. [
30], multi-objective stochastic linear optimization by Zhou and Li [
31], particle swarm optimization by Zhu et al. [
32], mean absolute deviation by Kalfin et al. [
33] and Ryoo [
34], neurodynamic optimization by Wang and Gan [
35], behavioral mean-variance and copula behavioral mean-variance by Mba et al. [
36], portfolio optimization via deep learning by Du [
37], and predictive control models of mean-variance by [
38]. Each model has strengths and weaknesses, and their application in various scenarios has led to significant advances in the field. The mean-variance model has been a valuable tool for understanding and optimizing portfolio capital. Ranković [
39] introduced a new mean-VaR optimization technique that utilizes a univariate Generalized Autoregressive Conditional Heteroscedasticity (GARCH) volatility model to estimate VaR. Then, Ashrafzadeh [
40] presented a hybrid approach that combines a convolutional neural network (CNN) with optimized hyperparameters using particle swarm optimization (PSO) for stock pre-selection. A mean-variance with forecasting (MVF) model is employed for portfolio optimization.
Some gaps from previous research can be used as opportunities for further research. These gaps are considered novel in this research. These gaps are as follows:
- (a)
In the clustering aspect, no one has used the K-means method with the mean and value at risk (VaR) attributes of returns from their stocks.
- (b)
Regarding capital weighting, no one has used the mean-VaR model involving income tax and transaction cost variables.
- (c)
No one has yet combined the MACD method for buying time analysis with the K-means method and the mean-VaR model.
Based on the introduction in this section, this research aims to develop stock selection and capital weighting mechanisms in designing stock portfolios based on clustering and analysis of stock buying times. Clustering was carried out using the K-means method. This method was chosen because of its fast iteration speed, timely efficiency, and simple ability to provide a clear and well-defined cluster solution to help investors understand the relationship patterns between stocks in a portfolio [
41]. Then, the time to buy stocks is analyzed using the moving average convergence–divergence (MACD) indication. MACD was chosen for its ability to provide clear buy or sell signals through the intersection of the MACD line and the signal line, allowing investors to identify optimal points to enter or exit the market quickly [
42]. Finally, the portfolio’s mechanism for weighting stock capital uses the mean value at risk (mean VaR) model involving transaction cost and income tax variables. The mean-VaR model was chosen because it can adjust investors’ courage in bearing risk by choosing return quantiles in the VaR calculation [
43]. This research academically develops a portfolio design mechanism by clustering stocks and analyzing its price movement trends, enabling investors to practically diversify and choose stocks with increasing price trends, reducing losses, and increasing profit opportunities.
5. Conclusions
This research develops the stock selection and capital weighting mechanisms for portfolio design. The stock selection mechanism is based on clustering analysis and analysis of the timing of buying and selling stocks. Clustering is conducted to select stocks with different characteristics to diversify risks. Then, an analysis of buying and selling times is carried out to reduce the chance of a decline in stock prices in the short term, thereby reducing the chance of loss from the portfolio. Clustering was carried out using the K-means method. This method was chosen because it is suitable for grouping shares based on mean and VaR characteristics. This suitability can be seen from its application, where the accuracy of using this method is above eighty percent. Then, the time to buy and sell stocks is analyzed using the moving average convergence–divergence (MACD) indication. MACD can describe stock price movements better than other indications because it uses two indication lines at once, namely the MACD line and the signal line. Finally, the portfolio’s mechanism for weighting stock capital uses the mean value at risk (mean VaR) model involving transaction cost and income tax variables. The mean-VaR model was chosen because it can adjust investors’ courage in bearing risk by choosing return quantiles in the VaR calculation.
The designed mechanism is then applied to Indonesia’s 100 stock index data. Experimental data also present the sensitivity of the critical variables involved. The results of the sensitivity analysis in this section all seem logical. It indicates that the stock selection and capital weighting mechanisms can describe the actual situation. Finally, we also compared the mechanism of this research (MI) with another mechanism, traditional mean-VaR (MII). Mean portfolio return from MI is achieved or even exceeds it. In contrast, the mean of portfolio return from MII is not achieved and is even negative. These results indicate that clustering and analysis of stock price movements should be carried out in forming a stock portfolio.
As a suggestion for future mechanism development, the loss probability value in Equation (11) can be involved theoretically without being assumed to be a constant value in the actual number interval between zero and one. However, this will make determining the solution of the mean-VaR model more complex. This solution can be sought using the genetic algorithm method as a further suggestion. Then, the use of MACD can be combined with other indicators to estimate rising stock price trends more accurately. In addition, MACD also needs to be used for conditional conditions, such as when economic chaos occurs. In other words, the jumping effect on stock returns, which often occurs in stocks in large stock markets such as in the United States of America, can be considered. The jumping effect can be accommodated using the jumping process.
This research academically develops a portfolio design mechanism by clustering stocks and analyzing its price movement trends, enabling investors to practically diversify and choose stocks with increasing price trends, reducing losses, and increasing profit opportunities.