Traditionally, most investment tools used to predict stocks are based on quantitative variables, such as finance and capital flow. With the widespread impact of the Internet, investors and investment institutions designing investment strategies are also referring to online comments and discussions. However, multiple information sources, along with uncertainties accompanying international political and economic events and the recent pandemic, have left investors concerned about information interpretation approaches that could aid investment decision-making. To this end, this study proposes a method that combines social media sentiment, genetic algorithm (GA), and deep learning to predict changes in stock prices. First, it employs a hybrid genetic algorithm (HGA) combined with machine learning to identify chip-based indicators closely related to fluctuations in stock prices and then uses them as input for long short-term memory (LSTM) to establish a prediction model. Next, this study proposes five sentiment variables to analyze PTT social media on TSMC’s stock price and performs a grey relational analysis (GRA) to identify the sentiment variables most closely related to stock price fluctuations. The sentiment variables are then combined with the selected chip-based indicators as input to build the LSTM prediction model. To improve the efficiency of the LSTM analysis, this study applies the Taguchi method to optimize the hyper-parameters. The results show that the proposed method of using HGA-screened chip-based variables and social media sentiment variables as input to establish an LSTM prediction model can effectively improve the prediction accuracy of stock price fluctuations.