Automated trading bots for XAUUSD (Gold) using MetaTrader 5, Google Gemini AI, and news sentiment analysis.
- Python 3.10+
- MetaTrader 5 installed and logged in
- Gemini API key
- NewsAPI key (only for
news_trade.py) - An Exness demo or real account
1. Clone the repository
git clone https://github.com/your-username/Exness-Strategy.git
cd Exness-Strategy2. Install dependencies
pip install -r requirements.txt3. Configure environment variables
cp env.example .envEdit .env with your credentials:
# API Keys
GEMINI_API_KEY=your_gemini_api_key
NEWS_API_KEY=your_news_api_key
# Exness Real Account
EXNESS_REAL_LOGIN=your_real_login
EXNESS_REAL_PASS=your_real_password
EXNESS_REAL_SERVER=ExnessKE-MT5Real9
# Exness Demo Account
EXNESS_DEMO_LOGIN=your_demo_login
EXNESS_DEMO_PASS=your_demo_password
EXNESS_DEMO_SERVER=ExnessKE-MT5Trial9
# Trading Params
SYMBOL=XAUUSD
LOT_SIZE=0.1
RISK_PER_TRADE=0.02
MINIMUM_SPREAD=0.2
STOP_LOSS= # Leave blank to disable
TAKE_PROFIT= # Leave blank to disable
# Set to 'real' to use live account, 'demo' for paper trading
ENVIRONMENT=demo
⚠️ Never commit your.envfile. It is already listed in.gitignore.
Trades mean-reversion setups on the M15 timeframe. When price touches the upper or lower Bollinger Band, it asks Gemini to confirm a reversal before entering.
| Detail | Value |
|---|---|
| Timeframe | M15 |
| Indicators | Bollinger Bands (20, 2) |
| AI Filter | Gemini 2.0 Flash |
| Check interval | 60 seconds |
python src/bot.pyTrades on the H1 timeframe using RSI and price action. Gemini analyses the last 10 candles and returns a BUY / SELL / HOLD decision. A hard RSI gate prevents buying when overbought (>70) or selling when oversold (<30).
| Detail | Value |
|---|---|
| Timeframe | H1 |
| Indicators | RSI (14), EMA (20) |
| AI Filter | Gemini 2.0 Flash |
| Check interval | 3600 seconds (1 hour) |
python src/llm_strategy.pyCombines H4 breakout levels with live news sentiment scored by Gemini. Only enters a trade when both the technical breakout and a strong sentiment score (>7.0 bullish / <-7.0 bearish) align.
| Detail | Value |
|---|---|
| Timeframe | H4 |
| Indicators | Support / Resistance levels |
| Sentiment source | NewsAPI + Gemini 2.0 Flash |
| Check interval | 300 seconds (5 minutes) |
Requires NEWS_API_KEY to be set in .env.
python src/news_trade.pyTrades H1 breakouts confirmed by VWAP position and AI conviction. Uses ATR-based dynamic stop loss and a fixed risk/reward ratio of 1:3.
| Detail | Value |
|---|---|
| Timeframe | H1 |
| Indicators | ATR (14), VWAP, 24h High/Low |
| AI Filter | Gemini 2.0 Flash |
| SL / TP | ATR × 2.0 / ATR × 6.0 |
| Check interval | 60 seconds |
python src/volume_weigted.pyA simple RSI strategy scaffold that does not connect to MT5 directly. Intended as a base template for building custom strategies on top of an Exness API wrapper.
python src/strategy_one.pyExness-Strategy/
├── src/
│ ├── bot.py # Bollinger Bands + Gemini AI (M15)
│ ├── llm_strategy.py # RSI + Gemini AI (H1)
│ ├── news_trade.py # News Sentiment + Breakout (H4)
│ ├── volume_weigted.py # VWAP + ATR + Gemini AI (H1)
│ └── strategy_one.py # RSI scaffold template
├── config.py # Centralised config loaded from .env
├── .env # Your local credentials (not committed)
├── env.example # Template for .env
└── requirements.txt # Python dependencies
Change the ENVIRONMENT variable in .env:
ENVIRONMENT=demo # Uses EXNESS_DEMO_* credentials
ENVIRONMENT=real # Uses EXNESS_REAL_* credentials
⚠️ Always test on demo before switching to a real account.
This software is for educational purposes only. Trading financial instruments carries significant risk. The authors are not responsible for any financial losses incurred through the use of these bots.
Copyright (c) 2025 David Muchoki. All rights reserved. See LICENSE for details.