تطبيق خوارزميات تعلم الآلة للتنبؤ باتجاه أسعار الأسهم في سوق الأسهم – حالة فيتنام
Applying machine learning algorithms to predict the stock price trend in the stock market – The case of Vietnam

المجلة: Humanities and Social Sciences Communications، المجلد: 11، العدد: 1
DOI: https://doi.org/10.1057/s41599-024-02807-x
تاريخ النشر: 2024-03-12
المؤلف: Tran Phuoc وآخرون
الموضوع الرئيسي: طرق التنبؤ بسوق الأسهم

نظرة عامة

تهدف هذه الدراسة إلى توقع اتجاهات أسعار الأسهم في اقتصاد ناشئ باستخدام خوارزمية الذاكرة طويلة وقصيرة الأجل (LSTM). يتضمن التحليل مؤشرات فنية متنوعة، بما في ذلك المتوسط المتحرك البسيط (SMA)، ومؤشر تقارب وتباعد المتوسطات المتحركة (MACD)، ومؤشر القوة النسبية (RSI)، إلى جانب بيانات ثانوية من مؤشر VN ومؤشرات VN-30.

تشير النتائج إلى أن نموذج التنبؤ القائم على LSTM يحقق معدل دقة مرتفع يبلغ 93% عبر معظم بيانات الأسهم التي تم تحليلها. تؤكد هذه النتيجة فعالية نموذج LSTM في تحليل وتوقع تحركات أسعار الأسهم في سياق التعلم الآلي، مما يثبت قابليته للتطبيق في توقعات السوق المالية.

طرق

تستخدم الدراسة خوارزمية الذاكرة طويلة وقصيرة الأجل (LSTM) إلى جانب مؤشرات التحليل الفني لتوقع اتجاهات الأسعار في سوق الأسهم الفيتنامي، مع التركيز بشكل خاص على مجموعة VN-30، التي تتكون من 30 سهمًا كبيرًا. تم الحصول على البيانات من vietstock.vn، والتي تغطي معلومات الأسعار التاريخية من تواريخ إدراج الأسهم حتى 1 أبريل 2021. هذه الفترة الزمنية ذات صلة خاصة بسبب تأثير الجائحة على ديناميات السوق. تتضمن مجموعة البيانات مقاييس متنوعة مثل أسعار الإغلاق، والافتتاح، وأعلى وأدنى الأسعار، وأحجام التداول، مع تصنيف يتماشى مع معيار التصنيف الصناعي العالمي (GICS).

تشمل المنهجية تقسيم البيانات إلى مجموعات تدريب واختبار، حيث تمتد مجموعة التدريب من تاريخ الإدراج حتى 31 ديسمبر 2020، ومجموعة الاختبار من 1 يناير 2021 حتى 1 أبريل 2021. تم هيكلة نموذج LSTM بأربع طبقات، باستخدام نافذة بيانات تاريخية لمدة 60 يومًا لتوقع أسعار الأسهم في اليوم التالي. تم تجميع النموذج باستخدام مُحسِّن آدم ومتوسط الخطأ التربيعي كدالة خسارة، مع إجراء التدريب على مدى 1000 دورة وحجم دفعة قدره 32. تم تنفيذ EarlyStopping لتعزيز الكفاءة الحسابية. يتم تقييم دقة النموذج التنبؤية مقابل الأسعار الفعلية في مجموعة الاختبار، مع تحديد دقة مرجعية تبلغ 93% بناءً على الحد الأقصى المسموح به لتقلب الأسعار في جلسة تداول. إذا انخفضت دقة النموذج عن هذا العتبة، يُعتبر غير فعال.

نتائج

تبحث الدراسة في تطبيق خوارزمية الذاكرة طويلة وقصيرة الأجل (LSTM) المدمجة مع مؤشرات التحليل الفني لتوقع اتجاهات الأسعار في سوق الأسهم الفيتنامي، مع التركيز بشكل خاص على مجموعة VN-30. استخدم التحليل مجموعة اختبار تتكون من 78 جلسة تداول من 1 يناير 2021 حتى 1 أبريل 2021. تشير النتائج إلى أن توقعات أسعار نموذج LSTM تتماشى بشكل وثيق مع الاتجاهات الفعلية في السوق، محققة دقة توقع إجمالية تتجاوز 93% لمعظم الأسهم التي تم تحليلها. ومن الجدير بالذكر أن سهم PNJ أظهر أعلى دقة بنسبة 97.7%، بينما أظهرت بعض الأسهم، مثل NVL، معدلات دقة أقل حوالي 78.9%.

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

نقاش

يتناول قسم النقاش في الورقة تعقيدات قابلية التنبؤ في سوق الأسهم، مشيرًا إلى النظريات الأساسية مثل فرضية السوق الفعالة (فاما، 1970) وفرضية المشي العشوائي (بورتون، 2018)، التي تقترح أن أسعار الأسهم تعكس جميع المعلومات المتاحة وتتغير بشكل مستقل عن الأسعار التاريخية. على الرغم من هذه النظريات، يجادل بعض الباحثين بإمكانية قابلية التنبؤ بأسعار الأسهم، مما يؤدي إلى تطوير طرق توقع متنوعة عبر التخصصات، بما في ذلك التحليل الفني. تعتمد هذه الطريقة على بيانات السوق التاريخية، مع التركيز على السعر والحجم، وتفترض أن تحركات الأسعار مدفوعة بديناميات العرض والطلب (كيركباتريك & دالهكويست، 2010). تشير الدراسات التجريبية، مثل تلك التي أجراها بروك وآخرون (1992) وفيفيلد وآخرون (2005)، إلى أن التحليل الفني يمكن أن يحقق قوة تنبؤية كبيرة، على الرغم من استمرار الانتقادات المتعلقة بتحيز البيانات.

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

Journal: Humanities and Social Sciences Communications, Volume: 11, Issue: 1
DOI: https://doi.org/10.1057/s41599-024-02807-x
Publication Date: 2024-03-12
Author(s): Tran Phuoc et al.
Primary Topic: Stock Market Forecasting Methods

Overview

This study aims to predict stock price trends in an emerging economy using the Long Short Term Memory (LSTM) algorithm. The analysis incorporates various technical indicators, including the Simple Moving Average (SMA), Moving Average Convergence Divergence (MACD), and Relative Strength Index (RSI), alongside secondary data from the VN-Index and VN-30 stocks.

The findings indicate that the LSTM-based forecasting model achieves a high accuracy rate of 93% across most stock data analyzed. This result underscores the effectiveness of the LSTM model in analyzing and forecasting stock price movements within the context of machine learning, validating its applicability for financial market predictions.

Methods

The research employs a Long Short-Term Memory (LSTM) algorithm alongside technical analysis indicators to forecast price trends in the Vietnamese stock market, specifically focusing on the VN-30 group, which comprises 30 large-cap stocks. Data was sourced from vietstock.vn, covering historical price information from the stocks’ listing dates up to April 1, 2021. This timeframe is particularly relevant due to the pandemic’s impact on market dynamics. The dataset includes various metrics such as closing, opening, highest, lowest prices, and trading volumes, with the classification adhering to the Global Industry Classification Standard (GICS).

The methodology involves dividing the data into training and testing sets, with the training set spanning from the listing date to December 31, 2020, and the testing set from January 1, 2021, to April 1, 2021. The LSTM model is structured with four layers, utilizing a 60-day window of historical data to predict the next day’s stock prices. The model is compiled using the Adam optimizer and mean squared error as the loss function, with training conducted over 1000 epochs and a batch size of 32. EarlyStopping is implemented to enhance computational efficiency. The model’s predictive accuracy is assessed against actual prices in the test set, with a benchmark accuracy of 93% established based on the maximum allowable price fluctuation in a trading session. If the model’s accuracy falls below this threshold, it is deemed ineffective.

Results

The research investigates the application of the Long Short-Term Memory (LSTM) algorithm combined with technical analysis indicators to forecast price trends in the Vietnamese stock market, specifically focusing on the VN-30 group. The analysis utilized a test set comprising 78 trading sessions from January 1, 2021, to April 1, 2021. Results indicate that the LSTM model’s price predictions closely align with actual market trends, achieving an overall forecast accuracy exceeding 93% for most stocks analyzed. Notably, the stock ticker PNJ demonstrated the highest accuracy at 97.7%, while some stocks, such as NVL, exhibited lower accuracy rates around 78.9%.

The findings affirm the LSTM model’s effectiveness in analyzing and forecasting stock price movements, corroborating previous studies in the field. The research highlights the potential of integrating technical analysis indicators with machine learning techniques, suggesting that such combinations can enhance predictive performance. However, the study acknowledges limitations, including the exclusive focus on structured data from the Ho Chi Minh City stock market and the challenges posed by market volatility and manipulation. Future research directions may involve exploring other machine learning algorithms, incorporating unstructured data, and expanding the dataset to include additional stock exchanges to improve forecasting robustness.

Discussion

The discussion section of the paper addresses the complexities of stock market predictability, referencing foundational theories such as the Efficient Market Hypothesis (Fama, 1970) and the Random Walk Hypothesis (Burton, 2018), which suggest that stock prices reflect all available information and change independently of historical prices. Despite these theories, some researchers argue for the potential predictability of stock prices, leading to the development of various forecasting methods across disciplines, including technical analysis. This method relies on historical market data, focusing on price and volume, and assumes that price movements are driven by supply and demand dynamics (Kirkpatrick & Dahlquist, 2010). Empirical studies, such as those by Brock et al. (1992) and Fifield et al. (2005), indicate that technical analysis can yield significant predictive power, although criticisms regarding data bias persist.

The section further explores the application of Long Short-Term Memory (LSTM) networks, a type of Recurrent Neural Network (RNN) designed to address issues like the vanishing and exploding gradient problems encountered in traditional RNNs (Hochreiter & Schmidhuber, 1997). LSTM networks, characterized by their memory cell architecture and gating mechanisms, have shown promise in modeling time series data, particularly in stock price prediction. Various studies highlight the effectiveness of LSTM in conjunction with natural language processing (NLP) techniques, sentiment analysis, and other input variables to enhance predictive accuracy (e.g., Chen et al., 2015; Zhuge et al., 2017). Overall, the findings underscore the growing recognition of LSTM’s capabilities in financial forecasting, as evidenced by its increasing application in recent research across different markets.