IDEAS home Printed from https://ideas.repec.org/a/plo/pone00/0263181.html
   My bibliography  Save this article

Deep reinforcement learning stock market trading, utilizing a CNN with candlestick images

Author

Listed:
  • Andrew Brim
  • Nicholas S Flann

Abstract

Billions of dollars are traded automatically in the stock market every day, including algorithms that use neural networks, but there are still questions regarding how neural networks trade. The black box nature of a neural network gives pause to entrusting it with valuable trading funds. A more recent technique for the study of neural networks, feature map visualizations, yields insight into how a neural network generates an output. Utilizing a Convolutional Neural Network (CNN) with candlestick images as input and feature map visualizations gives a unique opportunity to determine what in the input images is causing the neural network to output a certain action. In this study, a CNN is utilized within a Double Deep Q-Network (DDQN) to outperform the S&P 500 Index returns, and also analyze how the system trades. The DDQN is trained and tested on the 30 largest stocks in the S&P 500. Following training the CNN is used to generate feature map visualizations to determine where the neural network is placing its attention on the candlestick images. Results show that the DDQN is able to yield higher returns than the S&P 500 Index between January 2, 2020 and June 30, 2020. Results also show that the CNN is able to switch its attention from all the candles in a candlestick image to the more recent candles in the image, based on an event such as the coronavirus stock market crash of 2020.

Suggested Citation

  • Andrew Brim & Nicholas S Flann, 2022. "Deep reinforcement learning stock market trading, utilizing a CNN with candlestick images," PLOS ONE, Public Library of Science, vol. 17(2), pages 1-25, February.
  • Handle: RePEc:plo:pone00:0263181
    DOI: 10.1371/journal.pone.0263181
    as

    Download full text from publisher

    File URL: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0263181
    Download Restriction: no

    File URL: https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0263181&type=printable
    Download Restriction: no

    File URL: https://libkey.io/10.1371/journal.pone.0263181?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    References listed on IDEAS

    as
    1. Taewook Kim & Ha Young Kim, 2019. "Forecasting stock prices with a feature fusion LSTM-CNN model using different representations of the same data," PLOS ONE, Public Library of Science, vol. 14(2), pages 1-23, February.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Tashreef Muhammad & Tahsin Aziz & Mohammad Shafiul Alam, 2023. "Utilizing Technical Data to Discover Similar Companies in Dhaka Stock Exchange," Papers 2301.04455, arXiv.org.
    2. Akash Doshi & Alexander Issa & Puneet Sachdeva & Sina Rafati & Somnath Rakshit, 2020. "Deep Stock Predictions," Papers 2006.04992, arXiv.org.
    3. Simon Liebermann & Jung-Sup Um & YoungSeok Hwang & Stephan Schlüter, 2021. "Performance Evaluation of Neural Network-Based Short-Term Solar Irradiation Forecasts," Energies, MDPI, vol. 14(11), pages 1-21, May.
    4. Huang, Wenyang & Wang, Huiwen & Qin, Haotong & Wei, Yigang & Chevallier, Julien, 2022. "Convolutional neural network forecasting of European Union allowances futures using a novel unconstrained transformation method," Energy Economics, Elsevier, vol. 110(C).
    5. Catalin Stoean & Wiesław Paja & Ruxandra Stoean & Adrian Sandita, 2019. "Deep architectures for long-term stock price prediction with a heuristic-based strategy for trading simulations," PLOS ONE, Public Library of Science, vol. 14(10), pages 1-19, October.
    6. Nestoras Chalkidis & Rahul Savani, 2021. "Trading via Selective Classification," Papers 2110.14914, arXiv.org, revised Oct 2021.
    7. Yanyan Cui & Lixin Liu, 2022. "Investor sentiment-aware prediction model for P2P lending indicators based on LSTM," PLOS ONE, Public Library of Science, vol. 17(1), pages 1-17, January.
    8. Jun Zhang & Lan Li & Wei Chen, 2021. "Predicting Stock Price Using Two-Stage Machine Learning Techniques," Computational Economics, Springer;Society for Computational Economics, vol. 57(4), pages 1237-1261, April.
    9. Supriya Bajpai, 2021. "Application of deep reinforcement learning for Indian stock trading automation," Papers 2106.16088, arXiv.org.
    10. Rui Zhang & Zhen Guo & Yujie Meng & Songwang Wang & Shaoqiong Li & Ran Niu & Yu Wang & Qing Guo & Yonghong Li, 2021. "Comparison of ARIMA and LSTM in Forecasting the Incidence of HFMD Combined and Uncombined with Exogenous Meteorological Variables in Ningbo, China," IJERPH, MDPI, vol. 18(11), pages 1-14, June.
    11. Shalini Sharma & Angshul Majumdar & Emilie Chouzenoux & Victor Elvira, 2023. "Deep State-Space Model for Predicting Cryptocurrency Price," Papers 2311.14731, arXiv.org.
    12. Hakan Gunduz, 2021. "An efficient stock market prediction model using hybrid feature reduction method based on variational autoencoders and recursive feature elimination," Financial Innovation, Springer;Southwestern University of Finance and Economics, vol. 7(1), pages 1-24, December.
    13. Antonello Rosato & Rodolfo Araneo & Amedeo Andreotti & Federico Succetti & Massimo Panella, 2021. "2-D Convolutional Deep Neural Network for the Multivariate Prediction of Photovoltaic Time Series," Energies, MDPI, vol. 14(9), pages 1-18, April.
    14. Jireh Yi-Le Chan & Steven Mun Hong Leow & Khean Thye Bea & Wai Khuen Cheng & Seuk Wai Phoong & Zeng-Wei Hong & Yen-Lin Chen, 2022. "Mitigating the Multicollinearity Problem and Its Machine Learning Approach: A Review," Mathematics, MDPI, vol. 10(8), pages 1-17, April.
    15. Carlos A. Reyes Pérez & Miguel E. Iglesias Martínez & Jose Guerra-Carmenate & Humberto Michinel Álvarez & Eduardo Balvis & Fernando Giménez Palomares & Pedro Fernández de Córdoba, 2023. "Indoor Air Quality Analysis Using Recurrent Neural Networks: A Case Study of Environmental Variables," Mathematics, MDPI, vol. 11(24), pages 1-17, December.
    16. Lee, Donghyun & Kim, Mingyu & Lee, Beomhui & Chae, Sangwon & Kwon, Sungjun & Kang, Sungwon, 2022. "Integrated explainable deep learning prediction of harmful algal blooms," Technological Forecasting and Social Change, Elsevier, vol. 185(C).
    17. Xiaodong Zhang & Suhui Liu & Xin Zheng, 2021. "Stock Price Movement Prediction Based on a Deep Factorization Machine and the Attention Mechanism," Mathematics, MDPI, vol. 9(8), pages 1-21, April.
    18. Li, Houjian & Zhou, Deheng & Hu, Jiayu & Li, Junwen & Su, Mengying & Guo, Lili, 2023. "Forecasting the realized volatility of Energy Stock Market: A multimodel comparison," The North American Journal of Economics and Finance, Elsevier, vol. 66(C).
    19. Mimansa Rana & Nanxiang Mao & Ming Ao & Xiaohui Wu & Poning Liang & Matloob Khushi, 2021. "Clustering and attention model based for intelligent trading," Papers 2107.06782, arXiv.org, revised Aug 2021.
    20. Javier Oliver Muncharaz, 2020. "Comparing classic time series models and the LSTM recurrent neural network: An application to S&P 500 stocks [Comparativa de los models clásicos de series temporales con la red neuronal recurrente ," Post-Print hal-03149342, HAL.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:plo:pone00:0263181. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: plosone (email available below). General contact details of provider: https://journals.plos.org/plosone/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.