Presenting a Patch-Based Time Series Transformer Model for Financial Market Forecasting: A Case Study of Gold Price Prediction

Document Type : Original Article

Author
Meybod university
Abstract
This study employs novel deep learning approaches to accurately forecast gold prices, a critical economic indicator and a prominent safe-haven asset. The research investigates and compares the performance of Recurrent Neural Networks (RNNs) with a Transformer-based model, specifically the Patch Time Series Transformer (PatchTST), for forecasting the complex time series of gold prices, with the aim of demonstrating the superiority of attention-based mechanisms. A three-phase methodology was implemented: (1) data preprocessing, which included removing missing values, normalization, and creating time windows; (2) training the two model categories (RNNs and PatchTST); and (3) evaluating their performance using Root Mean Square Error (RMSE), Mean Absolute Error (MAE), and the Coefficient of Determination (R²). The results indicate that the PatchTST model significantly outperforms the RNN models. By leveraging the self-attention mechanism and processing data in patches, PatchTST more effectively captures complex, long-term dependencies within the gold price time series, achieving higher predictive accuracy. This superiority underscores the efficiency and innovation of transformer-based models for precise economic time series forecasting. By introducing PatchTST as a more accurate tool, this research provides significant scientific added value for analysts and investors in making informed financial decisions. By introducing PatchTST as a more accurate tool, this research provides significant scientific added value for analysts and investors in making informed financial decisions.
Keywords
Subjects


Articles in Press, Accepted Manuscript
Available Online from 18 July 2026