Modern portfolio theory has been researched and applied widely. This paper shows an application of the modern portfolio theory to choose optimal weights for a composite stock s portfolio. It could help optimize investors portfolio by increasing returns and decreasing volatility. Considering returns and volatility at the same time, Sharpe ration is a good indicator. To research portfolio optimization, this article uses Monte Carlo methods to acquire the weights of securities in portfolio that has the highest Sharpe ratio. Current studies about portfolio theory do not take safe securities into consideration. Therefore, this paper first concludes risk-free asset with other risky assets in portfolio. The portfolio in this study includes five stocks (Walmart, Amazon, Dexcom, Warner Bros., T. Rowe) in different sectors and risk-free asset (one-year U.S. Treasury Securities). The result shows that the weight of offline retail increases as the proportion of risk-free asset rises. This has implication that risk-averse investor might prefer offline retail stocks compared with other stocks in portfolio.