journal article·2024-09-23Open access

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

Applied Sciences· Volume 14· Issue 18

Abstract

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%.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Stock Market Forecasting Methods · Financial Markets and Investment Strategies · Energy Load and Power Forecasting

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Department of Computer Science and Information Engineering, National Taiwan University, Taipei 106319, Taiwan

Department of Computer Science and Information Engineering, Ming Chuan University, Taoyuan 333321, Taiwan

Funding

NSTC Taiwan

References (32)

Show source-provided references
1. (2023, September 16). ETF Overview, Taiwan Stock Exchange Corporation. Available online: https://www.twse.com.tw/en/products/securities/etf/overview/introduction.html.
2. Using genetic algorithms to find technical trading rules10.1016/S0304-405X(98)00052-X ↗
3. Black swans and the domains of statistics10.1198/000313007X219996 ↗
4. Lane, G. (Technical Analysis of Stocks & Commodities Magazine, 1984). The Stochastic Indicator, Technical Analysis of Stocks & Commodities Magazine.
5. Lee, K.-J., and Lu, S.-L. (2021). The Impact of COVID-19 on the Stock Price of Socially Responsible Enterprises: An Empirical Study in Taiwan Stock Market. Int. J. Environ. Res. Public Heal., 18.10.3390/ijerph18041398 ↗
7. Long short-term memory10.1162/neco.1997.9.8.1735 ↗
8. Deep learning with long short-term memory networks for financial market predictions10.1016/j.ejor.2017.11.054 ↗
9. Financial ratios, discriminant analysis and the prediction of corporate bankruptcy10.1111/j.1540-6261.1968.tb00843.x ↗
10. Finding structure in time10.1207/s15516709cog1402_1 ↗
11. Self-learning fuzzy controllers based on temporal backpropagation10.1109/72.159060 ↗
12. Generating fuzzy rules by learning from examples10.1109/21.199466 ↗
13. An overview of genetic algorithms: Part 1
14. Holland, J.H. (1975). Adaptation in Natural and Artificial Systems, University of Michigan Press. [1st ed.].
15. Chang, K.-T. (2011). A Collaborative Trading Model by Support Vector Regression and Fuzzy Rule for Stock Turning Points’ Prediction. [Master’s Thesis, Department of Information Management, Yuan Ze University].
16. Ho, K.-H. (2016). The Trading Performance of Technical Analysis: The Case of Taiwan 50 ETF. [Master Thesis, Department of International Business, National Taiwan University]. Available online: https://www.airitilibrary.com/Article/Detail/U0001-1706201617425300.
17. Wu, Y.-C. (2021). Stock Trading Using CNN-LSTM Neural Network Model. [Master’s Thesis, Institute of Computational and Modeling Science, National Tsing Hua University].
18. Huang, H.-S., and Chiu, I.-H. (2005). The Study of Neural Network to Predict Taiwan ETF-50 Stock Index Price. J. Inf. Technol. Soc., Available online: https://jitas.cpu.edu.tw/2005-2/2.pdf.
19. Shen, P.-H. (2020). Forecasting ETF50 Trend with LSTM and Two-time Trading Strategy. [Master’s Thesis, Department of Engineering Science and Ocean Engineering, National Taiwan University].
20. Chang, B.-N. (2001). Discussion on Applying Genetic Algorithm to Financial Index Stock Selection Strategy. [Master’s Thesis, Department of Information Management, National Central University].
21. A Theory of Market Equilibrium under Conditions of Risk
22. Cao, L., Luo, C., Ni, J., Luo, D., and Zhang, C. (2006, January 8–11). Stock Data Mining through Fuzzy Genetic Algorithm. Proceedings of the 2006 Joint Conference on Information Science (JCIS 2006), Kaohsiung, Taiwan.10.2991/jcis.2006.129 ↗
23. Corporate Financial Distress & Bankruptcy
24. Hillson, D. (2023). The Risk Management Handbook: A Practical Guide to Managing the Multiple Dimensions of Risk, Kogan Page Publishers.
25. Aggarwal, C.C. (2018). Neural Networks and Deep Learning, Springer.10.1007/978-3-319-94463-0 ↗
26. Russell, S.J., and Norvig, P. (2016). Artificial Intelligence: A Modern Approach, Pearson.
27. Holland, J.H. (1995). Hidden Order, McGraw-Hill. Business Week-Domestic Edition.
28. Gen, M., and Cheng, R. (1999). Genetic Algorithms and Engineering Optimization, John Wiley & Sons.10.1002/9780470172261 ↗
29. (2023, September 03). Keras. Available online: https://keras.io/.
30. Goldberg, D.E. (1989). Genetic Algorithms in Search, Optimization, and Machine Learning, Addison-Wesley.
31. (2023, June 03). PyGAD. Available online: https://pygad.readthedocs.io/en/latest/.
32. Yeh, W.-H. (2022). An Empirical Study on the Application of Fuzzy Decision System in Taiwan Stock Market. [Master’s Thesis, College of Electrical Engineering and Computer Science, National Ilan University].