IDEAS home Printed from https://ideas.repec.org/a/eee/finlet/v46y2022ipas1544612321003202.html
   My bibliography  Save this article

Forecasting directional movements of stock prices for intraday trading using LSTM and random forests

Author

Listed:
  • Ghosh, Pushpendu
  • Neufeld, Ariel
  • Sahoo, Jajati Keshari

Abstract

We employ both random forests and LSTM networks (more precisely CuDNNLSTM) as training methodologies to analyze their effectiveness in forecasting out-of-sample directional movements of constituent stocks of the S&P 500 from January 1993 till December 2018 for intraday trading. We introduce a multi-feature setting consisting not only of the returns with respect to the closing prices, but also with respect to the opening prices and intraday returns. As trading strategy, we use Krauss et al. (2017) and Fischer and Krauss (2018) as benchmark. On each trading day, we buy the 10 stocks with the highest probability and sell short the 10 stocks with the lowest probability to outperform the market in terms of intraday returns — all with equal monetary weight. Our empirical results 22All the codes are available on https://github.com/pushpendughosh/Stock-market-forecasting. show that the multi-feature setting provides a daily return, prior to transaction costs, of 0.64% using LSTM networks, and 0.54% using random forests. Hence we outperform the single-feature setting in Fischer and Krauss (2018) and Krauss et al. (2017) consisting only of the daily returns with respect to the closing prices, having corresponding daily returns of 0.41% and of 0.39% with respect to LSTM and random forests, respectively.33Fischer and Krauss (2018) and Krauss et al. (2017) obtain 0.46% and 0.43%, as the period from November 2015 until December 2018 was not included in their backtesting.

Suggested Citation

  • Ghosh, Pushpendu & Neufeld, Ariel & Sahoo, Jajati Keshari, 2022. "Forecasting directional movements of stock prices for intraday trading using LSTM and random forests," Finance Research Letters, Elsevier, vol. 46(PA).
  • Handle: RePEc:eee:finlet:v:46:y:2022:i:pa:s1544612321003202
    DOI: 10.1016/j.frl.2021.102280
    as

    Download full text from publisher

    File URL: http://www.sciencedirect.com/science/article/pii/S1544612321003202
    Download Restriction: Full text for ScienceDirect subscribers only

    File URL: https://libkey.io/10.1016/j.frl.2021.102280?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
    ---><---

    As the access to this document is restricted, you may want to search for a different version of it.

    References listed on IDEAS

    as
    1. Krauss, Christopher & Do, Xuan Anh & Huck, Nicolas, 2017. "Deep neural networks, gradient-boosted trees, random forests: Statistical arbitrage on the S&P 500," European Journal of Operational Research, Elsevier, vol. 259(2), pages 689-702.
    2. Sima Siami-Namini & Akbar Siami Namin, 2018. "Forecasting Economics and Financial Time Series: ARIMA vs. LSTM," Papers 1803.06386, arXiv.org.
    3. Lohrmann, Christoph & Luukka, Pasi, 2019. "Classification of intraday S&P500 returns with a Random Forest," International Journal of Forecasting, Elsevier, vol. 35(1), pages 390-407.
    4. Jiayu Qiu & Bin Wang & Changjun Zhou, 2020. "Forecasting stock prices with long-short term memory neural network based on attention mechanism," PLOS ONE, Public Library of Science, vol. 15(1), pages 1-15, January.
    5. Huck, Nicolas, 2009. "Pairs selection and outranking: An application to the S&P 100 index," European Journal of Operational Research, Elsevier, vol. 196(2), pages 819-825, July.
    6. Basak, Suryoday & Kar, Saibal & Saha, Snehanshu & Khaidem, Luckyson & Dey, Sudeepa Roy, 2019. "Predicting the direction of stock market prices using tree-based classifiers," The North American Journal of Economics and Finance, Elsevier, vol. 47(C), pages 552-567.
    7. Christopher Krauss & Anh Do & Nicolas Huck, 2017. "Deep neural networks, gradient-boosted trees, random forests: Statistical arbitrage on the S&P 500," Post-Print hal-01768895, HAL.
    8. Fischer, Thomas & Krauss, Christopher, 2018. "Deep learning with long short-term memory networks for financial market predictions," European Journal of Operational Research, Elsevier, vol. 270(2), pages 654-669.
    9. Perry Sadorsky, 2021. "A Random Forests Approach to Predicting Clean Energy Stock Prices," JRFM, MDPI, vol. 14(2), pages 1-20, January.
    10. Huck, Nicolas, 2010. "Pairs trading and outranking: The multi-step-ahead forecasting case," European Journal of Operational Research, Elsevier, vol. 207(3), pages 1702-1716, December.
    11. Marco Avellaneda & Jeong-Hyun Lee, 2010. "Statistical arbitrage in the US equities market," Quantitative Finance, Taylor & Francis Journals, vol. 10(7), pages 761-782.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Hwang, Yoontae & Park, Junpyo & Lee, Yongjae & Lim, Dong-Young, 2023. "Stop-loss adjusted labels for machine learning-based trading of risky assets," Finance Research Letters, Elsevier, vol. 58(PA).
    2. Caparrini, Antonio & Arroyo, Javier & Escayola Mansilla, Jordi, 2024. "S&P 500 stock selection using machine learning classifiers: A look into the changing role of factors," Research in International Business and Finance, Elsevier, vol. 70(PA).
    3. Illia Baranochnikov & Robert Ślepaczuk, 2022. "A comparison of LSTM and GRU architectures with novel walk-forward approach to algorithmic investment strategy," Working Papers 2022-21, Faculty of Economic Sciences, University of Warsaw.
    4. Kyungsub Lee, 2023. "Recurrent neural network based parameter estimation of Hawkes model on high-frequency financial data," Papers 2304.11883, arXiv.org.
    5. Evangelos Liaras & Michail Nerantzidis & Antonios Alexandridis, 2024. "Machine learning in accounting and finance research: a literature review," Review of Quantitative Finance and Accounting, Springer, vol. 63(4), pages 1431-1471, November.
    6. Fang, Yi & Chen, Yuzhi & Ren, Hang, 2023. "A factor pricing model based on machine learning algorithm," International Review of Economics & Finance, Elsevier, vol. 88(C), pages 280-297.
    7. Jakub Michańków & Paweł Sakowski & Robert Ślepaczuk, 2023. "Hedging Properties of Algorithmic Investment Strategies using Long Short-Term Memory and Time Series models for Equity Indices," Working Papers 2023-25, Faculty of Economic Sciences, University of Warsaw.
    8. Lee, Kyungsub, 2023. "Recurrent neural network based parameter estimation of Hawkes model on high-frequency financial data," Finance Research Letters, Elsevier, vol. 55(PA).
    9. Sungwoo Kang & Jong-Kook Kim, 2023. "Using a Deep Learning Model to Simulate Human Stock Trader's Methods of Chart Analysis," Papers 2304.14870, arXiv.org, revised Apr 2024.
    10. Cohen, Gil & Aiche, Avishay, 2023. "Forecasting gold price using machine learning methodologies," Chaos, Solitons & Fractals, Elsevier, vol. 175(P2).
    11. Barua, Ronil & Sharma, Anil K., 2022. "Dynamic Black Litterman portfolios with views derived via CNN-BiLSTM predictions," Finance Research Letters, Elsevier, vol. 49(C).
    12. Carvajal-Patiño, Daniel & Ramos-Pollán, Raul, 2022. "Synthetic data generation with deep generative models to enhance predictive tasks in trading strategies," Research in International Business and Finance, Elsevier, vol. 62(C).
    13. Yue-Jun Zhang & Han Zhang & Rangan Gupta, 2023. "A new hybrid method with data-characteristic-driven analysis for artificial intelligence and robotics index return forecasting," Financial Innovation, Springer;Southwestern University of Finance and Economics, vol. 9(1), pages 1-23, December.
    14. Jesús Molina‐Muñoz & Andrés Mora‐Valencia & Javier Perote, 2024. "Predicting carbon and oil price returns using hybrid models based on machine and deep learning," Intelligent Systems in Accounting, Finance and Management, John Wiley & Sons, Ltd., vol. 31(2), June.
    15. Gil Cohen, 2022. "Algorithmic Trading and Financial Forecasting Using Advanced Artificial Intelligence Methodologies," Mathematics, MDPI, vol. 10(18), pages 1-13, September.

    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. Pushpendu Ghosh & Ariel Neufeld & Jajati Keshari Sahoo, 2020. "Forecasting directional movements of stock prices for intraday trading using LSTM and random forests," Papers 2004.10178, arXiv.org, revised Jun 2021.
    2. Huck, Nicolas, 2019. "Large data sets and machine learning: Applications to statistical arbitrage," European Journal of Operational Research, Elsevier, vol. 278(1), pages 330-342.
    3. Han, Chulwoo & He, Zhaodong & Toh, Alenson Jun Wei, 2023. "Pairs trading via unsupervised learning," European Journal of Operational Research, Elsevier, vol. 307(2), pages 929-947.
    4. Flori, Andrea & Regoli, Daniele, 2021. "Revealing Pairs-trading opportunities with long short-term memory networks," European Journal of Operational Research, Elsevier, vol. 295(2), pages 772-791.
    5. Kolesnikova, A. & Yang, Y. & Lessmann, S. & Ma, T. & Sung, M.-C. & Johnson, J.E.V., 2019. "Can Deep Learning Predict Risky Retail Investors? A Case Study in Financial Risk Behavior Forecasting," IRTG 1792 Discussion Papers 2019-023, Humboldt University of Berlin, International Research Training Group 1792 "High Dimensional Nonstationary Time Series".
    6. Matthew Clegg & Christopher Krauss, 2018. "Pairs trading with partial cointegration," Quantitative Finance, Taylor & Francis Journals, vol. 18(1), pages 121-138, January.
    7. José Cerda & Nicolás Rojas-Morales & Marcel C. Minutolo & Werner Kristjanpoller, 2022. "High Frequency and Dynamic Pairs Trading with Ant Colony Optimization," Computational Economics, Springer;Society for Computational Economics, vol. 59(3), pages 1251-1275, March.
    8. Fischer, Thomas & Krauss, Christopher, 2018. "Deep learning with long short-term memory networks for financial market predictions," European Journal of Operational Research, Elsevier, vol. 270(2), pages 654-669.
    9. Thomas Günter Fischer & Christopher Krauss & Alexander Deinert, 2019. "Statistical Arbitrage in Cryptocurrency Markets," JRFM, MDPI, vol. 12(1), pages 1-15, February.
    10. Knoll, Julian & Stübinger, Johannes & Grottke, Michael, 2017. "Exploiting social media with higher-order Factorization Machines: Statistical arbitrage on high-frequency data of the S&P 500," FAU Discussion Papers in Economics 13/2017, Friedrich-Alexander University Erlangen-Nuremberg, Institute for Economics.
    11. Fischer, Thomas & Krauss, Christopher, 2017. "Deep learning with long short-term memory networks for financial market predictions," FAU Discussion Papers in Economics 11/2017, Friedrich-Alexander University Erlangen-Nuremberg, Institute for Economics.
    12. Rubesam, Alexandre, 2022. "Machine learning portfolios with equal risk contributions: Evidence from the Brazilian market," Emerging Markets Review, Elsevier, vol. 51(PB).
    13. Kim, A. & Yang, Y. & Lessmann, S. & Ma, T. & Sung, M.-C. & Johnson, J.E.V., 2020. "Can deep learning predict risky retail investors? A case study in financial risk behavior forecasting," European Journal of Operational Research, Elsevier, vol. 283(1), pages 217-234.
    14. Alexander Jakob Dautel & Wolfgang Karl Härdle & Stefan Lessmann & Hsin-Vonn Seow, 2020. "Forex exchange rate forecasting using deep recurrent neural networks," Digital Finance, Springer, vol. 2(1), pages 69-96, September.
    15. Ha, Youngmin & Zhang, Hai, 2020. "Algorithmic trading for online portfolio selection under limited market liquidity," European Journal of Operational Research, Elsevier, vol. 286(3), pages 1033-1051.
    16. Fabian Waldow & Matthias Schnaubelt & Christopher Krauss & Thomas Günter Fischer, 2021. "Machine Learning in Futures Markets," JRFM, MDPI, vol. 14(3), pages 1-14, March.
    17. Omer Berat Sezer & Mehmet Ugur Gudelek & Ahmet Murat Ozbayoglu, 2019. "Financial Time Series Forecasting with Deep Learning : A Systematic Literature Review: 2005-2019," Papers 1911.13288, arXiv.org.
    18. Schnaubelt, Matthias & Fischer, Thomas G. & Krauss, Christopher, 2020. "Separating the signal from the noise – Financial machine learning for Twitter," Journal of Economic Dynamics and Control, Elsevier, vol. 114(C).
    19. Schnaubelt, Matthias & Seifert, Oleg, 2020. "Valuation ratios, surprises, uncertainty or sentiment: How does financial machine learning predict returns from earnings announcements?," FAU Discussion Papers in Economics 04/2020, Friedrich-Alexander University Erlangen-Nuremberg, Institute for Economics.
    20. Kasper Johansson & Thomas Schmelzer & Stephen Boyd, 2024. "Finding Moving-Band Statistical Arbitrages via Convex-Concave Optimization," Papers 2402.08108, arXiv.org.

    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:eee:finlet:v:46:y:2022:i:pa:s1544612321003202. 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: Catherine Liu (email available below). General contact details of provider: http://www.elsevier.com/locate/frl .

    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.