OpenAI Gym trading env for MetaTrader 5, enabling RL-based trading algorithms
Top 64.4% on sourcepulse
This project provides a flexible, general-purpose simulator and OpenAI Gym environment for algorithmic trading strategies using the MetaTrader 5 platform. It caters to reinforcement learning researchers and traders looking to backtest and analyze strategies with a focus on code readability and end-to-end trading process management.
How It Works
The core is MtSimulator
, which mimics MetaTrader 5's trading logic, including order management, balance, equity, and margin calculations. It can download historical data via the MetaTrader5
Python package (Windows-only) or use custom data sources. The MtEnv
class wraps MtSimulator
into a standard Gym environment, processing historical price data into features and defining complex action/observation spaces suitable for RL algorithms. It handles data windows, feature extraction, and reward calculation.
Quick Start & Requirements
pip install gym-mtsim
download_data
) is Windows-only due to the MetaTrader5
package dependency.pip install stable-baselines3
Highlighted Details
human
, simple_figure
, advanced_figure
).Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
download_data
functionality is restricted to Windows due to the MetaTrader5
Python package.8 months ago
1 week