Applied Sciences (Sep 2024)

LSTM with Short-Term Bias Compensation to Determine Trading Strategy under Black Swan Events of Taiwan ETF50 Stock

  • Ray-I Chang,
  • Chia-Hui Wang,
  • Lien-Chen Wei,
  • Ya-Fang Lu

DOI
https://doi.org/10.3390/app14188576
Journal volume & issue
Vol. 14, no. 18
p. 8576

Abstract

Read online

This paper uses Long Short-Term Memory (LSTM) networks to predict the stock prices of the Yuanta Taiwan Top 50 ETF (ETF50). To improve the accuracy of the model’s predictions, a calibration procedure called “Short-Term Bias Compensation” (STBC) is proposed to adjust the predicted stock prices. In STBC, the daily prediction error is calculated to estimate the short-term bias (STB) in prediction. Then, the predicted price of its next day will be corrected if this STB has exceeded a certain threshold. In this paper, we apply Genetic Algorithms (GAs) to optimize the parameters used in STBC for providing more confidence in its estimation. Based on these predicted stock prices, we propose a Genetic Fuzzy System (GFS) to determine the trading strategy, with trading points for buying and selling stocks. In GFS, various technical indicators are used to establish the fuzzy rules of the trading strategy, and GAs are used to evolve the best parameters for these fuzzy rules. Our experiments cover over 17 years of data (from 2003 to 2020) for ETF50 to consider black swan events such as the 2020 COVID-19 pandemic, the 2018 US–China trade war, and the 2011 US debt crisis. The first 90% of the data is used as training data, and the last 10% is used as testing data. We use 12 technical indicators of these data as the input of LSTM. The predicted values of LSTM are corrected using STBC and compared to the uncorrected prices. We use Mean Square Error (MSE) to evaluate the prediction accuracy. The results show that STBC can nearly reduce 90% of the prediction error (where MSE drops from 11.5758 to 1.2687). By using GFS with STBC to determine trading points, we achieve a return rate of 32.0%.

Keywords