The QuantForge: MT5 AI Command Center is a professional-grade graphical interface designed for quantitative developers and algorithmic traders. Instead of relying on the clunky, native MetaTrader 5 interface, this command center wraps the MT5 engine into a highly aesthetic, responsive, and data-rich web application. It automates the generation of MT5 .ini files, interacts with the native terminal64.exe CLI, extracts strategy metrics, and features an integrated AI Strategy Analyst powered by Google Gemini.
- Glassmorphic Streamlit UI: A beautiful, dark-mode native web interface for managing your MT5 backtests.
- Batch Testing: Run multiple backtests across different symbols natively using Python's
ThreadPoolExecutor. - AI Strategy Analyst: Paste your Google Gemini API key to get instant, brutally honest quantitative analysis of your EA's performance (Drawdown, Calmar Ratio, Recovery Factor).
- Monte Carlo Simulations: Visualizes 500 potential probability cones for your equity curve to estimate worst-case drawdowns.
- History Ledger (SQLite): Automatically archives every single backtest run, allowing you to load up past equity curves instantly or export them to CSV.
-
Clone the Repository:
git clone https://github.com/nam3isrobin/QuantForge-MT5-AI-Command-Center.git cd QuantForge-MT5-AI-Command-Center -
Set up a Virtual Environment:
python -m venv .venv .venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Configure MT5 Path: Open
config.pyand modify theDEFAULT_MT5_TERMINAL_PATHandDEFAULT_MT5_DATA_PATHto point to your broker's MetaTrader 5 installation on your PC.# Example DEFAULT_MT5_TERMINAL_PATH = r"C:\Program Files\MetaTrader 5\terminal64.exe"
streamlit run app.py- Upload an Expert Advisor: Use the sidebar to upload any compiled
.ex5file. - Set Parameters: Adjust your starting deposit, dates, and input strings (e.g.
InpFastMA=10). - Run Backtests: Hit the Run button to dynamically dispatch the headless MT5 engine!
QuantForge dynamically overrides specific variables in your Expert Advisor to control risk and trading hours via the UI. For these specific UI toggles to take effect, your .mq5 code must expose the following input parameters:
input double InpRiskPercentage = 2.0; // Controls dynamic lot sizing
input string InpTradingHours = "0-23"; // Controls session filters (e.g. "8-12, 14-17")Note: If your EA does not use these exact input names, it will still backtest perfectly, but the Risk slider and Session checkboxes in the sidebar will simply have no effect on your strategy.
To use the Gemini AI features:
- Get a free API key from Google AI Studio.
- Paste it into the AI Analyst Configuration block in the sidebar.
- The UI will automatically detect all AI models available to your key. Select one, expand the AI section under your equity curve, and click Generate AI Analysis.
- Frontend: Streamlit, Plotly, Custom CSS
- Backend: Python 3, SQLite
- AI Integration:
google-generativeai - Trading Engine: MetaTrader 5 Native CLI (
terminal64.exe)
Pull requests are welcome! If you want to add Walk-Forward Optimization, integration with local LLMs, or support for passing custom historical tick data, feel free to fork the repository!
Disclaimer: QuantForge is a tool for quantitative research and educational purposes. Algorithmic trading in financial markets carries a high degree of risk and may not be suitable for all investors. Past performance is not indicative of future results.