forex.AI.XAUUSD
Author: ha0203028-langCreated Aug 22, 2026Updated Aug 22, 2026
AI Forex XAUUSD Auto-Trading Bot
Build a modular AI-powered XAUUSD trading bot.
Market
- Instrument: XAUUSD
- Primary timeframes: M5, M15, H1, H4
- Start with MT5 Demo account only
Technical Analysis
- EMA 20, 50, 200
- RSI
- MACD
- ATR
- ADX
- Bollinger Bands
- Support and Resistance
- Market Structure
- Higher High / Higher Low
- Lower High / Lower Low
- Break of Structure
AI / Machine Learning
- XGBoost baseline model
- LightGBM comparison
- BUY / SELL / NO-TRADE classification
- Probability/confidence score
- Feature engineering
- Out-of-sample testing
- Walk-forward validation
- Prevent data leakage and overfitting
Market Regime
Detect:
- Trending market
- Ranging market
- High volatility
- Low volatility
- News/high-impact conditions
Risk Management
- Configurable risk per trade
- Position sizing
- ATR-based Stop Loss
- Take Profit
- Maximum daily loss
- Maximum drawdown
- Maximum open positions
- Maximum spread
- Slippage protection
- Emergency kill switch
Trading Execution
- MetaTrader 5 integration
- Demo/paper trading first
- Order validation before execution
- Position monitoring
- Automatic SL/TP
- Trade logging
Backtesting
- Historical backtesting
- Spread
- Commission
- Slippage
- Out-of-sample testing
- Walk-forward testing
Database
Store:
- Market data
- Indicators
- AI predictions
- Signals
- Orders
- Positions
- Trade results
- Model versions
- Risk events
Dashboard
Show:
- Bot status
- XAUUSD price
- Market regime
- BUY/SELL/NO-TRADE signal
- AI probability
- Open positions
- Daily P/L
- Drawdown
- Win rate
- Profit factor
Alerts
- Trade signal alerts
- Trade execution alerts
- Daily loss alerts
- MT5 connection alerts
- Emergency stop alerts
Security
- Never expose broker credentials
- Never commit API keys or passwords
- Use environment variables/secrets
- Start in Demo/Paper mode
- No live trading until testing is completed
Development Order
- MT5 connection
- Market data
- Technical indicators
- Strategy engine
- XGBoost model
- Risk engine
- Backtesting
- Paper/Demo trading
- Monitoring
- Live trading only after validation
Acceptance Criteria
The bot must not place a live trade during development.
Every trade signal must contain:
- Symbol
- Direction
- Entry
- Stop Loss
- Take Profit
- Position size
- AI probability
- Risk percentage
- Reason for signal
All trades and decisions must be logged.
Source: HKUDS/AI-Trader