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. Huang, Wenyang & Zhao, Jianyu & Wang, Xiaokang, 2024. "Model-driven multimodal LSTM-CNN for unbiased structural forecasting of European Union allowances open-high-low-close price," Energy Economics, Elsevier, vol. 132(C).
    2. Paul Handro & Bogdan Dima, 2024. "Analyzing Financial Markets Efficiency: Insights from a Bibliometric and Content Review," Journal of Financial Studies, Institute of Financial Studies, vol. 16(9), pages 119-175, May.
    3. Tashreef Muhammad & Tahsin Aziz & Mohammad Shafiul Alam, 2023. "Utilizing Technical Data to Discover Similar Companies in Dhaka Stock Exchange," Papers 2301.04455, arXiv.org.
    4. Akash Doshi & Alexander Issa & Puneet Sachdeva & Sina Rafati & Somnath Rakshit, 2020. "Deep Stock Predictions," Papers 2006.04992, arXiv.org.
    5. 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.
    6. 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).
    7. 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.
    8. Nestoras Chalkidis & Rahul Savani, 2021. "Trading via Selective Classification," Papers 2110.14914, arXiv.org, revised Oct 2021.
    9. 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.
    10. 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.
    11. Supriya Bajpai, 2021. "Application of deep reinforcement learning for Indian stock trading automation," Papers 2106.16088, arXiv.org.
    12. 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.
    13. Shalini Sharma & Angshul Majumdar & Emilie Chouzenoux & Victor Elvira, 2023. "Deep State-Space Model for Predicting Cryptocurrency Price," Papers 2311.14731, arXiv.org.
    14. 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.
    15. 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.
    16. 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.
    17. 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.
    18. Satya Verma & Satya Prakash Sahu & Tirath Prasad Sahu, 2024. "Two-Stage Hybrid Feature Selection Approach Using Levy’s Flight Based Chicken Swarm Optimization for Stock Market Forecasting," Computational Economics, Springer;Society for Computational Economics, vol. 63(6), pages 2193-2224, June.
    19. 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).
    20. 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.

    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.