نماذج التعلم العميق لتوقع أسعار إغلاق الأسهم في سوق الأسهم السعودي Deep Learning Models for Predicting Stock Closing Prices in the Saudi Stock Market

شارك:
المجلة: Journal of Computer Science، المجلد: 22، العدد: 4
DOI: https://doi.org/10.3844/jcssp.2026.1370.1386
تاريخ النشر: 2026-04-01
المؤلف: Areej Alhumaidi وآخرون
الموضوع الرئيسي: طرق التنبؤ بسوق الأسهم

نظرة عامة

تدرس هذه الدراسة التنبؤ بأسعار الإغلاق للشركات المدرجة في سوق الأسهم السعودي باستخدام نماذج التعلم العميق على مدى عقد من البيانات التاريخية (2013-2023). تستخدم البحث أربعة نماذج رئيسية – الذاكرة طويلة وقصيرة المدى (LSTM)، الذاكرة طويلة وقصيرة المدى ثنائية الاتجاه (Bi-LSTM)، وحدات التكرار المغلقة (GRU)، والشبكات العصبية التلافيفية (CNN) – إلى جانب نموذجين هجينين (GRU-LSTM و CNN-LSTM) لتعزيز دقة التنبؤ. تم تقييم النماذج باستخدام خمسة مقاييس انحدار: متوسط الخطأ التربيعي (MSE)، متوسط الخطأ المطلق (MAE)، متوسط الخطأ المطلق النسبي (MAPE)، الجذر التربيعي لمتوسط الخطأ التربيعي (RMSE)، ومعامل التحديد (R²). تكشف النتائج أن نماذج GRU و GRU-LSTM تفوقت بشكل كبير على الآخرين، حيث حققت GRU أدنى MSE و RMSE، بينما تفوقت GRU-LSTM في MAE و MAPE، مما يدل على قوتها ودقتها في التنبؤ بأسعار الأسهم.

تسلط الدراسة الضوء على فعالية منهجيات التعلم العميق في التقاط تعقيدات بيانات السلاسل الزمنية المالية، مما يوفر رؤى قيمة للمستثمرين والمؤسسات المالية في السوق السعودي. ومع ذلك، تعترف بوجود قيود، مثل استبعاد العوامل الخارجية مثل المؤشرات الاقتصادية الكلية والتركيز على سوق واحد، مما قد يؤثر على قابلية تعميم النتائج. يمكن أن تتضمن الأبحاث المستقبلية هذه التأثيرات الخارجية وتستكشف تطبيقات البيانات في الوقت الحقيقي لتعزيز استراتيجيات التداول الآلي، وبالتالي معالجة عدم القدرة على التنبؤ الكامنة في ديناميكيات سوق الأسهم.

مقدمة

تسلط مقدمة هذه الورقة البحثية الضوء على الدور الحاسم لسوق الأسهم في النظام المالي العالمي، مع التأكيد على التحديات المرتبطة بالتنبؤ بدقة بحركات أسعار الأسهم بسبب عوامل ديناميكية متنوعة مثل المؤشرات الاقتصادية الكلية، والأحداث السياسية، ومشاعر المستثمرين. غالبًا ما تفشل الطرق التحليلية التقليدية، بما في ذلك التحليل الأساسي والفني، في التقاط تعقيدات بيانات السلاسل الزمنية المالية، لا سيما في سياق سوق الأسهم السعودي (تداول)، الذي يعد الأكبر في منطقة الشرق الأوسط وشمال إفريقيا. تؤكد الورقة على إمكانيات نماذج التعلم العميق، وخاصة الذاكرة طويلة وقصيرة المدى (LSTM) وهياكل وحدات التكرار المغلقة (GRU)، لتحسين دقة التنبؤ من خلال نمذجة الطبيعة غير الخطية والمتقلبة لأسعار الأسهم بشكل فعال.

تهدف الدراسة إلى تقييم منهجي لأداء نماذج التعلم العميق في التنبؤ بأسعار الأسهم، مقارنة بين هياكل مختلفة، وتطوير نماذج هجينة تدمج بين عدة أساليب لتعزيز دقة التنبؤ. من خلال معالجة الفجوات في الأبحاث الحالية – مثل نقص المقارنات الشاملة عبر هياكل مختلفة ومواءمة اختيار النموذج مع خصائص مجموعة البيانات – تسعى الدراسة إلى تقديم رؤى قيمة حول فعالية التعلم العميق في سياق السوق المالية السعودية. ستستخدم التقييم عدة مقاييس انحدار، بما في ذلك متوسط الخطأ التربيعي (MSE) ومتوسط الخطأ المطلق النسبي (MAPE)، لتقييم الأداء التنبؤي عبر مجموعة بيانات كبيرة تضم 131 شركة مدرجة بشكل عام على مدى عقد، مما يمثل مساهمة كبيرة في مجال التنبؤ المالي.

طرق

في الدراسة التي أجراها باد غوش وآخرون (2024)، تم استخدام نماذج التعلم العميق المختلفة – MLP، RNN، LSTM، و CNN – للتنبؤ بأسعار الأسهم باستخدام بيانات تاريخية من البورصة الوطنية (NSE) في الهند وبورصة نيويورك (NYSE). ركز التحليل على أسعار الإغلاق اليومية، مع تحديد حجم نافذة 200 كأفضل حجم لتنبؤ لمدة 10 أيام. تم تقييم النماذج باستخدام متوسط الخطأ المطلق النسبي (MAPE)، مما يكشف أن نموذج CNN أظهر دقة متفوقة في التنبؤ بأسعار NYSE على الرغم من تدريبه على بيانات NSE. تؤكد هذه الأبحاث على فعالية الشبكات العصبية في التقاط الأنماط غير الخطية المعقدة، والتي تكافح النماذج التقليدية مثل ARIMA للتعامل معها.

استكشفت تحقيقات إضافية من ساكو وآخرين (2022) والكتبي وآخرين (2022) نماذج RNN و LSTM و GRU للتنبؤ بأسعار صرف العملات وأسعار الأسهم، على التوالي. وجدت ساكو وآخرون أن نماذج GRU تفوقت على الآخرين في كل من التنبؤ الأحادي والمتعدد المتغيرات. قدم الكتبي وآخرون مجموعة ميزات جديدة حسنت دقة التنبؤ، حيث أظهرت نماذج LSTM أداءً معززًا. بالإضافة إلى ذلك، أظهر النفاوي والذهياني (2022) فعالية نماذج LSTM و MLP في التنبؤ بأسعار الأسهم في سوق الأسهم السعودي، محققين قيم R² تتجاوز 99%. بشكل جماعي، تسلط هذه الدراسات الضوء على إمكانيات هياكل التعلم العميق في التنبؤ المالي، مما يبرز الحاجة إلى التحقق القوي ومجموعات الميزات الشاملة لتعزيز دقة التنبؤ.

نتائج

تقيم نتائج الدراسة أداء ستة نماذج مطورة من خلال خمسة مقاييس رئيسية: متوسط الخطأ التربيعي (MSE)، الجذر التربيعي لمتوسط الخطأ التربيعي (RMSE)، متوسط الخطأ المطلق (MAE)، متوسط الخطأ المطلق النسبي (MAPE)، ومعامل التحديد ($R^2$). توفر هذه المقاييس تقييمًا شاملاً لدقة النماذج التنبؤية وفعاليتها في التقاط الأنماط الأساسية للبيانات.

تشير التحليلات إلى أن النماذج تظهر درجات متفاوتة من الأداء عبر المقاييس، مما يبرز نقاط قوتها وضعفها في سياقات مختلفة. تقترح النتائج أن بعض النماذج قد تكون أكثر ملاءمة لتطبيقات معينة بناءً على معدلات الخطأ وقوة التفسير، كما هو موضح من خلال قيم $R^2$. يضع هذا التقييم الأساس لمزيد من التحسين والتطوير للنماذج في الأبحاث المستقبلية.

نقاش

في قسم النقاش من الورقة البحثية، يبرز المؤلفون فعالية تقنيات الذكاء الاصطناعي (AI) والتعلم العميق (DL) في تحليل سوق الأسهم، لا سيما في سياق سوق الأسهم السعودي (تداول). استخدمت الدراسة مجموعة بيانات شاملة تضم 516,364 ملاحظة من 249 شركة على مدى 11 عامًا، والتي تم تنقيحها إلى 131 شركة ذات تاريخ تداول متسق. تضمنت البيانات ميزات متنوعة مثل أسعار الافتتاح والإغلاق، وحجم التداول، وعدد الصفقات، والتي تمت معالجتها بدقة من خلال تقنيات تنظيف البيانات، واختيار الميزات، والتوحيد لتحسين أداء النموذج.

نفذ المؤلفون عدة نماذج للتعلم العميق، بما في ذلك الذاكرة طويلة وقصيرة المدى (LSTM)، الذاكرة طويلة وقصيرة المدى ثنائية الاتجاه (Bi-LSTM)، وحدات التكرار المغلقة (GRU)، ونماذج هجينة مثل CNN-LSTM و GRU-LSTM. تم استخدام مقاييس التقييم مثل متوسط الخطأ التربيعي (MSE)، ومتوسط الخطأ المطلق (MAE)، و R² لتقييم أداء النموذج. من الجدير بالذكر أن نموذج GRU تفوق على الآخرين من حيث MSE و R²، وذلك بفضل هيكله الفعال الذي يلتقط الاعتماديات قصيرة المدى مع عدد أقل من المعلمات. حقق النموذج الهجين GRU-LSTM أدنى MAE ومتوسط الخطأ المطلق النسبي (MAPE)، مما يدل على دقة تنبؤية متفوقة من خلال التوازن الفعال بين التقلبات قصيرة المدى والاتجاهات طويلة المدى. تؤكد النتائج على أهمية اختيار هياكل النماذج المناسبة التي تتماشى مع الخصائص الزمنية للبيانات المالية، مما يشير إلى أن النماذج الهجينة يمكن أن تستفيد من نقاط القوة في أساليب مختلفة لتحسين توقعات أسعار الأسهم.

Journal: Journal of Computer Science, Volume: 22, Issue: 4
DOI: https://doi.org/10.3844/jcssp.2026.1370.1386
Publication Date: 2026-04-01
Author(s): Areej Alhumaidi et al.
Primary Topic: Stock Market Forecasting Methods

Overview

This study investigates the forecasting of closing prices for companies listed on the Saudi stock market using deep learning models over a decade of historical data (2013-2023). The research employs four primary models—Long Short-Term Memory (LSTM), Bidirectional LSTM (Bi-LSTM), Gated Recurrent Units (GRU), and Convolutional Neural Networks (CNN)—alongside two hybrid models (GRU-LSTM and CNN-LSTM) to enhance predictive accuracy. The models were evaluated using five regression metrics: Mean Squared Error (MSE), Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), Root Mean Squared Error (RMSE), and the coefficient of determination (R²). The findings reveal that the GRU and GRU-LSTM models significantly outperformed the others, with GRU achieving the lowest MSE and RMSE, while GRU-LSTM excelled in MAE and MAPE, indicating their robustness and accuracy in stock price prediction.

The study highlights the effectiveness of deep learning methodologies in capturing the complexities of financial time series data, providing valuable insights for investors and financial institutions in the Saudi market. However, it acknowledges limitations, such as the exclusion of external factors like macroeconomic indicators and the focus on a single market, which may affect the generalizability of the results. Future research could incorporate these external influences and explore real-time data applications to enhance automated trading strategies, thereby addressing the inherent unpredictability of stock market dynamics.

Introduction

The introduction of this research paper highlights the critical role of the stock market in the global financial system, emphasizing the challenges associated with accurately predicting stock price movements due to various dynamic factors such as macroeconomic indicators, political events, and investor sentiment. Traditional analytical methods, including fundamental and technical analysis, often fall short in capturing the complexities of financial time series data, particularly in the context of the Saudi stock market (Tadawul), which is the largest in the MENA region. The paper underscores the potential of deep learning models, particularly Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) architectures, to improve prediction accuracy by effectively modeling the non-linear and volatile nature of stock prices.

The study aims to systematically evaluate the performance of deep learning models in forecasting stock prices, comparing various architectures, and developing hybrid models that integrate multiple approaches to enhance predictive accuracy. By addressing gaps in existing research—such as the lack of comprehensive comparisons across different architectures and the alignment of model selection with dataset characteristics—the study seeks to provide valuable insights into the effectiveness of deep learning in the context of the Saudi financial market. The evaluation will utilize multiple regression metrics, including Mean Squared Error (MSE) and Mean Absolute Percentage Error (MAPE), to assess predictive performance across a substantial dataset of 131 publicly listed companies over a decade, marking a significant contribution to the field of financial forecasting.

Methods

In the study by Padh Ghosh et al. (2024), various deep learning models—MLP, RNN, LSTM, and CNN—were employed to predict stock prices using historical data from the National Stock Exchange (NSE) of India and the New York Stock Exchange (NYSE). The analysis focused on day-wise closing prices, with a window size of 200 identified as optimal for a 10-day forecast. The models were evaluated using Mean Absolute Percentage Error (MAPE), revealing that the CNN model exhibited superior accuracy in predicting NYSE prices despite being trained on NSE data. This research underscores the efficacy of neural networks in capturing complex nonlinear patterns, which traditional models like ARIMA struggle to address.

Further investigations by Sako et al. (2022) and Alkhatib et al. (2022) explored RNN, LSTM, and GRU models for forecasting foreign exchange rates and stock prices, respectively. Sako et al. found that GRU models outperformed others in both univariate and multivariate forecasting. Alkhatib et al. introduced a novel feature set that improved prediction accuracy, with LSTM models showing enhanced performance. Additionally, Al-Nefaie and Aldhyani (2022) demonstrated the effectiveness of LSTM and MLP models in predicting stock prices in the Saudi Stock Exchange, achieving R² values exceeding 99%. Collectively, these studies highlight the potential of deep learning architectures in financial forecasting, emphasizing the need for robust validation and comprehensive feature sets to enhance predictive accuracy.

Results

The results of the study assess the performance of six developed models through five key metrics: Mean Squared Error (MSE), Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), and the coefficient of determination ($R^2$). These metrics provide a comprehensive evaluation of the models’ predictive accuracy and effectiveness in capturing the underlying data patterns.

The analysis indicates that the models exhibit varying degrees of performance across the metrics, highlighting their strengths and weaknesses in different contexts. The findings suggest that certain models may be more suitable for specific applications based on their error rates and explanatory power, as indicated by the $R^2$ values. This evaluation lays the groundwork for further refinement and optimization of the models in future research.

Discussion

In the discussion section of the research paper, the authors highlight the effectiveness of artificial intelligence (AI) and deep learning (DL) techniques in stock market analysis, particularly within the context of the Saudi stock exchange (Tadawul). The study utilized a comprehensive dataset comprising 516,364 observations from 249 companies over an 11-year period, which was refined to 131 companies with consistent trading histories. The data included various features such as opening and closing prices, trading volume, and number of trades, which were meticulously processed through data cleaning, feature selection, and standardization techniques to enhance model performance.

The authors implemented several deep learning models, including Long Short-Term Memory (LSTM), Bidirectional LSTM (Bi-LSTM), Gated Recurrent Unit (GRU), and hybrid models like CNN-LSTM and GRU-LSTM. Evaluation metrics such as Mean Squared Error (MSE), Mean Absolute Error (MAE), and R² were employed to assess model performance. Notably, the GRU model outperformed others in terms of MSE and R², attributed to its efficient architecture that captures short-term dependencies with fewer parameters. The hybrid GRU-LSTM model achieved the lowest MAE and Mean Absolute Percentage Error (MAPE), indicating superior predictive accuracy by effectively balancing short-term fluctuations and long-term trends. The findings underscore the importance of selecting appropriate model architectures that align with the temporal characteristics of financial data, suggesting that hybrid models can leverage the strengths of different approaches for improved stock price predictions.