Accurately predicting stock market indices' returns is crucial for making informed financial decisions. This study introduces a hybrid approach using machine learning models to forecast the relative returns of five major global stock indices: S&P 500 (US), FTSE 100 (UK), Nikkei 225 (Japan), DAX 30 (Germany), and CAC 40 (France). By employing Long Short-Term Memory (LSTM), Dual-Layer LSTM (DL-LSTM), and Transformer models with Multi-Head Self-Attention, we aim to capture both short-term and long-term trends for better prediction accuracy. The dataset includes stocks from these indices from January 1, 2019, to December 31, 2023, ensuring stability by excluding stocks with frequent index changes. The results show that the DL-LSTM model significantly outperforms both traditional and other machine learning models in predicting relative returns, improving accuracy, recall, precision, and root mean square error (RMSE). This research highlights the potential of advanced machine learning techniques in financial market analysis, offering valuable insights for investors and financial analysts. The study not only enhances predictive accuracy but also adds to the growing literature on hybrid models in financial forecasting.