1. Introduction
One of the crucial stages in forming a stock investment portfolio is the selection of stocks [
1,
2]. The selection must be based on the characteristics of certain stocks, for example, the average profit and loss. In detail, the stocks selected must have different characteristics. This selection of stocks in a portfolio with different characteristics is referred to as diversification. Diversification can minimize portfolio losses [
3,
4]. In simple terms, if the portfolio contains stocks with the same characteristics, the loss experienced when the price of these falls is enormous. However, if diversification is applied, the loss of one stock can be covered by another stock whose price rises. In other words, diversification also makes the profit opportunities from the portfolio greater. In addition to considering the different characteristics, the selection of stocks in forming a portfolio must also consider price movements [
5,
6]. The selected stock must have a price movement that tends to rise. This is because stocks with an increasing price trend generally indicate high demand. If that happens, the stock price will too rise [
7,
8]. In other words, selecting stocks with rising price trends can increase opportunities for profits and reduce opportunities for losses that may occur in the future.
After the stock selection, another important step is the capital weighting for each stock in the portfolio [
9,
10]. This weighting can practically be conducted based on minimizing losses and maximizing profits, as first introduced by Markowitz [
11]. In general, stocks with large average losses also have large average profits, and vice versa [
12,
13]. If investors want to avoid the risk of large losses, the capital weight on stocks with high average losses can be reduced. The consequence is that the return obtained is small. However, if investors are willing to take the risk of loss, the weight of stocks with large average losses can be increased. Thus, the opportunity for profit is also greater. It should be noted that the weight allocated to each stock should be positive. In other words, stocks are not bought on debt. It avoids the risk of default on debt when stocks fail [
14,
15,
16,
17]. Apart from minimizing losses and maximizing profits, investors must consider administrative costs, e.g., transaction costs and income taxes. Even though the value of both is small, both can be detrimental if the profit is small. This can give rise to a negative mean of portfolio return [
18].
The development of studies examining the mechanism of weighting stock capital in forming investment portfolios is briefly explained in this paragraph. Markowitz [
19] first introduced a capital weighting model in portfolios called mean-variance. Then, Sharpe [
20] made the model into a matrix form to make it more efficient in computing time. These two pieces of study became the basis for future research, e.g., the capital asset pricing model (CAPM) [
21] and the minimax portfolio model [
22]. Then, Björk et al. [
23] developed a mean-variance model in continuous time, where risk aversion is assumed to depend on investors’ wealth. Using the conic programming approach, Ghaoui et al. [
24] developed the Markowitz model for worst-case value-at-risk. Then, Abdurakhman [
25] introduced a robust portfolio mean-variance-skewness model to accommodate abnormal and asymmetric problems of stock returns. Then, Faramarzi et al. [
26] introduced the equilibrium optimizer model for weighting stock capital in portfolios. Zhou and Li [
27] designed a multiobjective optimization model that is stochastic, linear-quadratic (LQ), and has a continuous time index in the capital stock weighting problem. Zhu et al. [
28] introduced particle swarm optimization (PSO) to solve the problem of optimizing multiobjective portfolio weights with non-linear constraints. Kalfin et al. [
29] and Ryoo [
30] introduced a mean-absolute-deviation model for the unique case weighting stock capital, where the covariance matrix between stock returns is singular. Wang and Gan [
31] designed a weighting model for stock capital in a portfolio with targeted performance criteria through neurodynamic optimization. Dai and Kang [
32] developed a mean-variance model by considering the L1 regulation of the objective function and the shrinkage method of Ledoit and Wolf [
33] in forming the return covariance matrix. Then, Mba et al. [
34] developed a mean-variance model using behavioral mean-variance (BMV) and copula behavioral mean-variance (CBMV). Du [
35] presented a new mean-variance model built using a stationary portfolio of cointegrated stocks based on deep learning. Li et al. [
36] developed a mean-variance model whose modal weight allocation is given by a predictive control model with the aim of risk parity.
Since the 2000s, the topic has focused on weighting stock capital and expanded to stock selection mechanisms through clustering. Chen and Huang [
37] introduced a clustering-based stock selection mechanism through the K-Means algorithm with the following attributes: average return, the standard deviation of returns, the Treynor index, and turnover rate. Then, they weighted the capital using a fuzzy return rate through a mean-variance model. Sinha et al. [
38] clustered the stocks in the portfolio using a genetic algorithm and weighted the capital using a minimized variance portfolio model. Golosnoy and Okhrin [
39] developed a mean-variance model by involving shrinkage in measuring the mean of the covariance matrix of stock returns. Ren et al. [
40] applied the K-Means algorithm to cluster stocks with attribute correlation coefficients between stocks. Fleischhacker et al. [
41] 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. Then, they weighted the capital using Pareto optimization and two objectives: costs and carbon emissions. Tola et al. [
42] clustered stock data using the average linkage algorithm with characteristic attributes of the correlation coefficient between stock returns and weighted the capital using a mean-variance model. Then, in their research, Chen et al. [
43] and Cheong et al. [
44] used the K-Means algorithm with the characteristic attribute mean of return for clustering stock data. Then, they weighted the capital using a mean-variance model. Musmeci et al. [
45] compared the K-Medoids, linkage, and directed bubble hierarchical tree methods with the attributes of the correlation coefficient between stocks. Fawaid et al. [
46] compared the K-Means and average linkage clustering algorithms with the mean of return and variance of return attributes. Then, they weighted the capital using the mean-value-at-risk model. Khan and Mehlawat [
47] clustered stocks using fuzzy C-means clustering and weighted stock capital in the portfolio using a genetic algorithm. Finally, Hussain et al. [
48] proposed new mechanisms for cluster stocks, which are the Adaptive Neuro-Fuzzy Inference System (ANFIS) and Induced Ordered Weighted Averaging (IOWA) model.
Several studies have also considered the price movement analysis in their selection and weighting of the capital of stocks in the portfolio. Navarro et al. [
49] carried out stock clustering using K-Means, price analysis using the MACD method, and capital weighting using the mean-variance model. Aheer et al. [
50] clustered stocks in a portfolio using a feed-forward neural network, analyzed their price movements using geometric Brownian motion, and weighted the capital using a mean-variance model. Then, Sukono et al. [
51] analyzed the stock price movement using ARIMA-GARCH and weighted its capital using the mean-value-at-risk model. Then, Du and Tanaka-Ishii [
52] analyzed stock price movement using a NEWS-STock space with Event Distribution (NESTED) and weighted the capital using a mean-variance model. Chang et al. [
53] conducted mixed integer programming for weighting the capital in the portfolio. They took advantage of price movements using behavioral stock (B-stock). Varga-Haszonits and Kondor [
54] investigated the capital weight of the stock in the portfolio using minimum variance portfolio optimization. The stock price movement was assumed to follow the constant conditional correlation GARCH process proposed by Bollerslev. Thuankhonrak et al. [
55] carried out stock clustering using a support vector machine (SVM) and artificial neural network (ANN), price analysis using the ARIMA and Holt Winter method, and capital weighting using a mean-variance model.
Gaps from previous studies are discussed in this paragraph. In general, stock clustering in previous studies used K-Means. This is because the method is intuitive. Stock clusters are determined based on the similarity of their attributes. This similarity is seen from the closest distance between the stock attribute values and the center point of the cluster (called the centroid), e.g., Euclidean distance [
40]. Then, the stocks selected are the stocks with the best characteristic attribute values in each cluster. Of course, the selected stocks have a positive average return. Then, in general, the capital weighting of stocks in the portfolio is carried out using the mean-variance model. However, no one has integrated the mean-variance model with transaction cost and income tax variables, even though transaction costs and income tax are essential to involve. Finally, analysis of stock price movements in previous studies was not focused on a specific method. In other words, the methods used vary. However, there has been no research using moving-average indicators. This method is simple and fast for practitioners in the capital market for short-term investments. Therefore, this gap is used as a novelty in this study.
Based on this introduction, this study aims to develop a mechanism for selecting and weighing the capital of stocks in a portfolio based on a clustering algorithm and price movement analysis. Stocks with a positive mean of returns are selected for clustering. Clustering is conducted using the K-Means method based on the attributes of the mean and variance of returns. This method is intuitively based on the closest distance between stock attributes and the centroid of a cluster, as mentioned in the previous paragraph. After clustering is conducted, stocks with an increasing trend are considered to reselect again. The increasing trend in this research is explored weekly using the fifth and tenth orders of moving average values, abbreviated as MA5 and MA10. If MA5 exceeds MA10, daily stock prices this week tend to be higher than in the previous weeks. In other words, the stock has an increasing price tendency now. Therefore, the selected stocks must have an MA5 greater than MA10. After increasing trend reselection, the best stock from each cluster is chosen based on the Sharpe ratio measure. After that, the capital weight of each stock is determined using the mean-variance model with the addition of administrative costs, e.g., transaction costs and income taxes. The model is also intuitive, based on the investor’s goal of maximizing the return mean and minimizing the return variance. After the mechanism is designed, its application is conducted on Index 80 stock data in Indonesia. Finally, the sensitivity of investors’ risk aversion, transaction cost, income tax, and increasing trend to the mean and variance of return is analyzed. This research is expected to assist investors in selecting and weighing stocks in a portfolio designed based on cluster-based and price movement analysis.
5. Conclusions
This research develops a mechanism for selecting and weighing capital in stock investment portfolios by considering stock clusters and price movement trends. Stock clustering is carried out to diversify the risk of loss from each stock in the portfolio, and the price movement trend is considered to reduce the risk of decreasing stock prices in the following period. Clustering is carried out using the intuitive and practical K-means method. This cluster chosen in this method is based on the shortest distance between the mean and variance of stock returns (used as attributes) and the centroid. Then, the price movement trend is analyzed using moving-average order five (MA5) and ten (MA10) indicators. If MA5 is more significant than MA10, the stock price has an increasing trend. This is because the daily price also tends to rise so that the average increases. Then, capital weighting is carried out using a mean-variance model with the addition of transaction cost and income tax variables.
The mechanism can be applied to stock data in various capital markets in economically stable countries so there are no return jumps. This research applies the mechanism to 80 index stock data from Indonesia. After carrying out 100 clusterization experiments, we obtained eight stock clusters in Indonesia. Several particular clusters were filled with stocks in the same sector. After clustering, 25 stocks were identified as having an increasing price trend in the short term based on the moving-average indicator. In short, the final stock selection results produced seven stocks: BBRI, SMGR, BBNI, BMTR, KLBF, ENRG, and AMRT. The stock with the most significant capital weight was AMRT, while the stock with the smallest was SMGR. Then, with the capital of 1 IDR, the mean portfolio return on the following day was estimated at IDR with a risk of loss of IDR. In detail, this estimate is smaller than the actual mean return obtained. This indicates that the selection and capital weighting mechanisms can be used effectively by considering clustering and stock price movement trends. Thus, investors’ risk aversion is sensitive to the mean and variance of their portfolio returns. The greater the investor’s risk aversion, the greater the mean and variance of the portfolio return, and vice versa. Finally, transaction costs and income taxes also significantly affect the mean of portfolio return. Therefore, investors must check transaction costs and income taxes before investing to avoid a negative mean of portfolio returns.
This research can help investors form a stock investment portfolio, especially in selecting and weighing the capital of stocks. The sensitivity of investors’ risk aversion can be illustrative in making selection decisions and weighing stocks. Then, investors can consider the effects of transaction costs and income taxes from investments to avoid the negative mean of portfolio returns.
This study has several shortcomings that can be used as opportunities for further research. This study only uses the Sharpe measure in selecting the optimum portfolio. Other measures can be used to measure it, e.g., the SIRF measure [
70], the risk assessment method [
71], and the global CAPM equilibrium [
72]. Then, the liability variables of each company can also be considered. It can measure the quality of stocks fundamentally. Finally, jumps in stock returns can also be involved in further research. It actually makes sense if investments are made in assets with extreme fluctuations. It is also suitable for use in disaster situations.