A robust cryptocurrency trading bot implementing mean reversion and trend-following strategies using RSI, TMA, and Bollinger Bands. Built with Django, Celery, and CCXT.
A premium, distributed algorithmic trading system designed for High-Probability Mean Reversal on Crypto markets (BTC, ETH, DOGE). Based on the 813% ROI backtested strategy.
The system utilizes a Client-Server architecture to bridge the gap between your secure Ubuntu environment and the Windows-exclusive MetaTrader 5 terminal.
graph LR
subgraph "Ubuntu Host (Backend)"
UI[💻 Premium Web Dashboard] <--> API[FastAPI Server]
API <--> Engine[Strategy Engine]
Engine <--> DB[(MariaDB)]
Engine --> TG[Telegram Bot]
end
subgraph "Windows VM (Agent)"
Engine <--"HTTP"---> Agent[Windows Agent]
Agent <--> MT5[MetaTrader 5]
end
Achu (Originally forked, rewriten and enhanced by Achu)
MIT
- Premium Dashboard: Glassmorphism UI with real-time charts, balance, and equity display.
- Multi-Asset Support: Simultaneously trades BITCOIN, ETHEREUM, and DOGECOIN.
- Smart Risk Management: Dynamic position sizing (default 5% risk per trade).
- Real-Time Alerts: Instant Telegram notifications for every trade execution.
- Persistent Logging: Full trade history stored in a MariaDB database.
- Robust Logic:
- Mean Reversal: 4H RSI Extremes + SuperTrend Confirmation + High ADX -> Limit Order.
- TMA System:
A specialized strategy for XAUUSD (GOLD) utilizing DEMA, SuperTrend, and Bollinger Bands.
- Trend Filter: 200 DEMA (Double Exponential Moving Average).
- Signal: SuperTrend (12, 3).
- Exit: Bollinger Bands (20, 2) Touch OR SuperTrend Flip.
- Safety: "Secret Tip" logic prevents entering if price is already at the Band extremes (overbought/oversold).
- Timeframes: 45m, 15m, 5m concurrently.
Trend + CMO Pullbacks + ADX Strength.
Run this on your Windows VM where MT5 is installed.
- Install Python: Download & Install Python 3.10+ for Windows.
- Setup Agent:
- Copy the
windows_agentfolder to your VM. - Open CMD in that folder.
- Install dependencies:
pip install -r requirements.txt
- Copy the
- Run Agent:
python agent.py
📝 Note: Keep this window open. Note down the IP address displayed (e.g.,
192.168.122.121).
Run this on your main Linux machine.
- System Requirements:
sudo apt-get update sudo apt-get install -y mariadb-server libmariadb-dev
- Environment Setup:
# Create virtual env python3 -m venv venv source venv/bin/activate # Install dependencies pip install -r backend/requirements.txt pip install mariadb python-telegram-bot
- Database Setup:
sudo mysql -e "CREATE DATABASE IF NOT EXISTS algo_trading; CREATE USER IF NOT EXISTS 'bot_user'@'localhost' IDENTIFIED BY 'bot_pass'; GRANT ALL PRIVILEGES ON algo_trading.* TO 'bot_user'@'localhost'; FLUSH PRIVILEGES;"
- Start the dashboard:
./venv/bin/python -m backend.main
- Open http://localhost:8000.
- In Settings, enter your VM's IP:
http://192.168.122.121:8001. - Click Update Configuration.
- Message your bot
@Acp3050with/start. - Run the helper tool to find your Chat ID:
./venv/bin/python -m backend.get_chat_id
- Copy the ID (e.g.,
5998452008). - Update
backend/config.py:TELEGRAM_CHAT_ID: str = "5998452008"
- Restart the backend to apply changes.
- Open Terminal in the project folder.
- Run Command:
./venv/bin/python -m backend.main
- Open Dashboard: Go to
http://localhost:8000. - Click "Run All": This activates the bot. You will see a "Bot Started" alert on Telegram.
- Pause Trading: Click "Stop All" on the Dashboard. This stops the bot from taking new trades.
- Shutdown Server: Go to your terminal and press
Ctrl+C.
- Ensure your Windows Agent is running on the VM.
- Run the Backend Command (Step 2 above).
- Refresh the Dashboard and click "Run All".
The bot will automatically reconnect and send you a "Connection Restored" alert.
This bot uses a confluence of 4 high-reliability indicators:
- RSI (Relative Strength Index): Identifies Overbought (>70) or Oversold (<30) conditions on the 4-Hour timeframe.
- SuperTrend: Ensures we only trade in the direction of the macro trend.
- ADX: Filters out choppy markets (Must be > 20).
- Bollinger Bands: Uses Mean Reversion to enter at the outer bands, betting on a return to the mean.
- TMA Strategy:
- Trend: Confirmed by Price > TEMA (Triple EMA).
- Strength: ADX > 25.
- entry: CMO (Chande Momentum Oscillator) Overbought/Oversold Pullback.
- "Connection Error":
- Ensure Windows VM firewall allows port
8001. - Check if you can ping the VM from Ubuntu.
- Ensure Windows VM firewall allows port
- "404 Error":
- Check if the symbol names in
backend/config.pymatch your MT5 Market Watch exactly (e.g.,BTCUSDvsBITCOIN).
- Check if the symbol names in
- "Mariadb Config Not Found":
- Ensure
libmariadb-devis installed. - Run pip with config path:
MARIADB_CONFIG=/usr/bin/mariadb_config pip install mariadb
- Ensure
Created by Achu 🚀