LSTM-Based Forex Trading Bot Using Python and MetaTrader 5: Design, Simulation, and Evaluation
DOI:
https://doi.org/10.31763/iota.v5i3.971Keywords:
LSTM trading Bot, forex forecasting, MetaTrader 5, time-series prediction, algorithmic trading, financial automationAbstract
This paper presents the development of an AI-driven forex trading bot that utilizes a Long Short-Term Memory (LSTM) neural network to forecast short-term price movements and automate trading decisions. The objective of the study is to create a scalable, data-driven system capable of improving trade accuracy using historical USD-JPY price data in conjunction with the MetaTrader 5 platform. The proposed system integrates a time-series preprocessing pipeline, LSTM-based price prediction, and a logic-driven trade simulation model to assess performance under controlled conditions. The model achieved a directional accuracy of 88.4%, a profit accuracy of 78%, and a cumulative simulated profit of USD 797.50 over 100 trades. Additionally, training and validation losses stabilized after 50 epochs, indicating effective learning without overfitting. Visual comparisons between actual and predicted prices further validated the model’s forecasting ability. The results highlight the potential of LSTM models to support intelligent financial automation and provide a foundation for future enhancements, including real-time deployment and hybrid AI-based trading strategies.