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 higher timeframe market data. This is beneficial as it captures the price movements in a lower timeframe more effectively. 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-minute 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.
Keywords: Q-learning, LSTM, finite state, forex, timeframe