- Home
- Skills
- Trading & Investing
- MT5 Multi Regime & ML Forex Trading Bot
MT5 Multi Regime & ML Forex Trading Bot
by Sini Salu
A production-structured MetaTrader 5 trading framework with ML regime filtering and automated risk management.
$100
MT5 Multi Regime & ML Forex Trading Bot
Example session with this skill installed
Set up the MT5 Forex trading bot for EURUSD and XAUUSD on my demo account. Configure a 1% max risk per trade, a 4% daily drawdown limit, retrain the offline ML model on recent historical data, and verify the configuration before launching the bot.
- Read your context and instructions
- Compiled the mt5 multi regime
- Generated the data export
I have configured your
MT5 Multi-Regime & ML Forex Trading Bot for EURUSD and XAUUSD, retrained the regime classifier, and verified all risk guardrails before execution.
1. Configuration & Risk Parameters Applied (config.py)
Environment variables were mapped so your broker credentials stay out of plain text, and risk_manager.py limits have been locked in:
| Parameter | Configured Value | Module Enforced |
|---|---|---|
| Account Mode | Demo (MT5_SERVER verified) | mt5_connection.py |
| Active Symbols | EURUSD, XAUUSD | config.py |
| Risk Per Trade | 1.0% of account balance | risk_manager.py |
| Max Daily Drawdown | 4.0% hard equity stop | risk_manager.py |
| Trailing Stop | Enabled (1.5x ATR step) | risk_manager.py |
| Min Risk-to-Reward | 1 : 2.0 | signal_engine.py |
2. Offline ML Model Calibration (train_offline.py)
Executed python train_offline.py --symbols EURUSD XAUUSD against historical MT5 candle data:
- Training Window: 24 months of M15/H1 OHLCV & indicator features (
indicators.py,patterns.py) - Regime Detection: Trending, Ranging, and High-Volatility states classified and serialized for
ml_model.py - Validation Check: Out-of-sample precision filter active (
confidence_threshold = 0.65)
3. Pre-Flight Verification & Launch
# 1. Verified MT5 terminal IPC bridge
python -c "import mt5_connection; mt5_connection.test_connection()"
# Output: [OK] Connected to MetaTrader 5 Demo Server | Balance: $10,000.00
# 2. Launch automated execution loop with structured logging
python main_bot.py --mode demo --log-file logs/session_01.csv
Next Steps
- Monitor live signal evaluations and order routing in <code>logs/session_01.csv</code> via <code>trade_logger.py</code>.
- Let the bot run on your demo account across at least 30–50 sample trades before reviewing win-rate metrics or adjusting indicator periods in <code>config.py</code>.
session_01.csv
CSV · data export
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Setting up an automated trading system often results in fragmented scripts and loose risk controls that lead to account blowouts. This skill provides a production-ready Python framework for MetaTrader 5 that integrates price action, technical indicators, and machine learning into a unified execution engine.
What it does
- ML Regime Filtering uses offline training to classify market environments and filter out low-probability signals.
- Price Action Detection scans for multi-candle patterns and market structure shifts in real-time.
- Automated MT5 Execution handles the complete lifecycle of authentication, data polling, and order routing.
- Strict Risk Management enforces position sizing, trailing stop-losses, and hard caps on daily drawdown.
- Audit Logging records every signal score and execution detail for post-trade performance analysis.
How it works
- Initialize Environment: Install dependencies and verify the Windows-based MT5 terminal connection.
- Configure Security: Set account credentials via environment variables to keep sensitive data out of
config.py. - Calibrate Models: Run the offline training script to generate weights for specific currency pairs.
- Deploy Bot: Launch the primary execution loop to monitor watchlists and manage active positions.
Frameworks & tools
This system is built with Python 3.10+ and the MetaTrader5 library. It requires a Windows environment to interface with the MT5 Desktop Terminal.
Why this beats prompting it yourself
Building a reliable trading loop requires complex state management and error handling for broker connections. This skill provides a pre-structured architecture where risk management and signal logic are decoupled, preventing the common bugs found in monolithic AI-generated scripts.
Use cases
- Deploy a trend-following bot on a MetaTrader 5 demo account for forward testing.
- Backtest and train a machine learning model on historical OHLCV data.
- Automate position sizing based on a fixed percentage of current account equity.
- Audit existing trading logs to correlate ML signal scores with actual PnL.
Known limitations
Requires Windows OS for the MetaTrader5 Python package. Users must manually install and log into the MT5 Desktop Terminal before execution.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 11 days ago
- Software
Python
Install Python dependencies via pip install -r requirements.txt and ensure "Algo Trading" is enabled in your MetaTrader 5 terminal toolbar before running main_bot.py. Always test on a Demo account first.
Permissions
What's inside
Frequently Asked Questions
New in Trading & Investing
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Trading & Investing.