Skip to main content

Algorithmic Forex Trading Using Q-learning

  • Conference paper
  • First Online:
Artificial Intelligence Applications and Innovations (AIAI 2023)

Abstract

The forex market is a difficult market for traders to succeed. The high noise and volatility of the forex market make the traders very hard to open and close position accurately. Many approaches have been proposed to overcome these difficulties, including algorithmic trading. This research proposed a framework for algorithmic trading using Q-learning with the help of LSTM. The proposed framework uses a finite state space in reinforcement learning to use holding time and higher timeframe market data. The state space is designed so that the agent can open and close positions flexibly, without being restricted by a fixed time window. This allows the agent to take profits and avoid losses. The proposed framework was trained and tested using 15 years’ worth of historical data of the EUR/USD currency pair in 5-min timeframe data. The system was evaluated based on various metrics such as profit, drawdown, Sharpe ratio, holding time, and delta time. The results show that with its designed finite state space and flexible time window, the proposed framework achieved consistent profits, reduced losses, and increased overall profits. This suggests that the proposed framework may be a suitable solution for forex market trading.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 109.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD 139.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Hayley, S., Marsh, I.W.: What do retail FX traders learn? J. Int. Money Financ. 64, 16–38 (2016). https://doi.org/10.1016/J.JIMONFIN.2016.02.001

    Article  Google Scholar 

  2. Moeeni, S.: Is It Necessary to Restrict Forex Financial Trading ? A Modified Model 1 Introduction, vol. 13(1), pp. 63–80 (2019)

    Google Scholar 

  3. Shavandi, A.,  Khedmati, M.: A multi-agent deep reinforcement learning framework for algorithmic trading in financial markets. Expert Syst. Appl. 208,  118124 (2022): https://doi.org/10.1016/j.eswa.2022.118124

  4. Chakole, J.B., Kolhe, M.S., Mahapurush, G.D., Yadav, A., Kurhekar, M.P.: A Q-learning agent for automated trading in equity stock markets. Expert Syst. Appl. 163, 113761 (2021). https://doi.org/10.1016/j.eswa.2020.113761

    Article  Google Scholar 

  5. Huang, C.Y.: Financial Trading as a Game: A Deep Reinforcement Learning Approach, pp. 1–15 (2018). http://arxiv.org/abs/1807.02787

  6. Carapuço, J., Neves, R., Horta, N.: Reinforcement learning applied to Forex trading. Appl. Soft Comput. J. 73, 783–794 (2018). https://doi.org/10.1016/j.asoc.2018.09.017

    Article  Google Scholar 

  7. Zarkias, K.S., Passalis, N., Tsantekidis, A., Tefas, A.: Deep reinforcement learning for financial trading using price trailing. In:  ICASSP, International Conference on Acoustics, Speech, and Signal Processing  Proceedings,  vol. 2019, pp. 3067–3071 (May 2019). https://doi.org/10.1109/ICASSP.2019.8683161

  8. Pring, M.J.: Technical analysis explained : the successful investor’s guide to spotting investment trends and turning points,  p. 797

    Google Scholar 

  9. Treleaven, P., Galas, M., Lalchand, V.: Algorithmic trading review. Commun. ACM 56(11), 76–85 (2013). https://doi.org/10.1145/2500117

    Article  Google Scholar 

  10. Fundamental analysis in the multi-agent trading system | IEEE Conference Publication | IEEE Xplore. https://ieeexplore.ieee.org/abstract/document/7733396 (Accessed 02 Feb 2023)

  11. Wanniarachchi, H.J., Rathnayake, R.M.S.J.K.,  Thilina, S.G.I., Ganegoda, G.U.,  Manawadu, I.:  Macroeconomic event base expert advisor for forex trades: through algo trading. In: 21st International Conference on Advances in ICT for Emerging Regions, ICter 2021 - Proceedings, pp. 189–194 (2021).  https://doi.org/10.1109/ICTER53630.2021.9774804

  12. Salkar, T., Shinde, A., Tamhankar, N., Bhagat, N.: Algorithmic trading using technical indicators. In: Proceedings of International Conference on Communication, Information  and Computing  Technology,  ICCICT 2021 (2021).  https://doi.org/10.1109/ICCICT50803.2021.9510135

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Hasna Haifa Zahrah .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 IFIP International Federation for Information Processing

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Zahrah, H.H., Tirtawangsa, J. (2023). Algorithmic Forex Trading Using Q-learning. In: Maglogiannis, I., Iliadis, L., MacIntyre, J., Dominguez, M. (eds) Artificial Intelligence Applications and Innovations. AIAI 2023. IFIP Advances in Information and Communication Technology, vol 675. Springer, Cham. https://doi.org/10.1007/978-3-031-34111-3_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-34111-3_3

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-34110-6

  • Online ISBN: 978-3-031-34111-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics