Predicting complex, volatile, and nonlinear financial stock prices is a challenging task due to the multitude of factors and inherent uncertainty that influence the financial market. This paper proposes a novel approach based on a neural network model that combines the Hodrick-Prescott (HP) filter and a Multi-Scale Gaussian transformer to address these challenges. The proposed method enhances the local features of the model by employing a multi-scale Gaussian transformer. Firstly, the time series of stocks is decomposed into long-term and short-term fluctuations using the HP filter. Next, the encoded long-term and short-term series are input into a multi-scale Gaussian transformer. Finally, a Multi-Scale Gaussian prior is introduced to further enhance the local features of the transformer and improve the relative positional information features of the time series. Compared to popular recurrent neural networks such as RNN, LSTM, GRU, and state-of-the-art baseline models, ours model (HPMG-Transformer) has the unique advantage of capturing both extremely long-term and short-term dependencies in stock time series. Experimental results demonstrate the significant advantages of our proposed model in predicting stock trends in the China A-shares market, New York Stock Exchange (NYSE) and NASDAQ market .INDEX TERMS stock price, artificial neural network, time series, HP filter, transformer.