LSTM neural network has been widely used in stock price forecasting, but it has some problems such as difficulty in selecting superparameters, insufficient information of original price sequence, etc. Based on this, the model propose an improved method based on functional principal component analysis and distance covariance weighted model averaging. On the one hand, the method solves the problem that the original stock price information may not be sufficient to predict future price trends by using the functional principal component basis expansion coefficient of the intraday price to capture the residual sequence between the LSTM neural network predicted value and the real stock price. On the other hand, for the superparameter selection of LSTM neural network, the method uses a model averaging method based on distance covariance, which effectively balances the variance and bias of the prediction model. Furthermore, the regression method between the residuals sequence and the basis expansion coefficient of the functional principal component is model free. The actual data analysis shows that the proposed method has a greater improvement in MSE and BE than the original LSTM. Finally, the proposed method can be viewed as an optimization framework. This method can also modify ARIMA, GARCH and other models, and it can also be applied to other time series data prediction background.