When designing a stock portfolio, investors must select stocks with different characteristics and increasing price trends and weigh each capital. Both are fundamental to diversifying loss and profit. Therefore, the mechanisms that accommodate both are needed. Based on this, this research aims to design a stock selection and capital weighing mechanism using the MACD-K-means-Mean-VaR model. The moving average convergence–divergence (MACD) is used to analyze stock buying time, providing trend, momentum, and potential price reversal insights. Then, stocks with increasing price trends are clustered using K-means, a grouping simple pattern data method based on specific characteristics. The best stocks from each cluster are capital weighted using the mean value at risk (mean-VaR), a portfolio optimization model adjusting loss possibility to the investor’s acceptance tolerance. The mechanism is then applied to Indonesia’s 100 stock index data to analyze variable sensitivities and compare it with another model. The application reveals that all variables significantly impact portfolio return mean and VaR, suggesting the need for clustering and analyzing stock price movements in stock portfolio design. This research academically develops a portfolio design mechanism by clustering stocks and analyzing price movement trends. It enables investors to practically diversify and choose stocks with increasing price trends, reducing losses and increasing profit opportunities.