A sophisticated cryptocurrency trading bot that implements an enhanced Dollar Cost Averaging (DCA) strategy with multiple technical indicators, risk management, and real-time monitoring.
- Multi-indicator approach combining RSI, MACD, Bollinger Bands, and SMA
- Dynamic position sizing based on signal strength and confidence
- Configurable base amounts and maximum multipliers
- Minimum interval enforcement between trades
- RSI (Relative Strength Index): Identifies overbought/oversold conditions
- MACD (Moving Average Convergence Divergence): Trend following and momentum
- Bollinger Bands: Volatility and price channel analysis
- SMA (Simple Moving Average): Trend direction identification
- Maximum position size limits
- Balance percentage restrictions
- Minimum balance thresholds
- Configurable risk parameters
- Prometheus metrics integration
- Health check endpoints
- Real-time performance tracking
- Grafana dashboards
- Telegram integration for trade alerts
- Configurable notification levels
- Real-time status updates
- Historical data analysis
- Performance metrics calculation
- Strategy optimization tools
The bot follows a clean architecture pattern optimized for DCA strategies:
- Exchange Interface: Abstract interface for different exchanges (Binance implementation included)
- Strategy Engine: Modular strategy system with multiple indicators
- Risk Management: Position sizing and order validation
- Monitoring: Health checks and metrics via Prometheus
- Notifications: Telegram integration for alerts
- REST API: Efficient market data retrieval for DCA strategy
- Go 1.24 or later
- Docker and Docker Compose
- Binance API credentials (for live trading)
-
Clone the repository
git clone https://github.com/Zmey56/enhanced-dca-bot.git cd enhanced-dca-bot -
Install dependencies
-
Configure environment variables
export EXCHANGE_API_KEY="your_binance_api_key" export EXCHANGE_SECRET="your_binance_secret" export TELEGRAM_TOKEN="your_telegram_bot_token" export TELEGRAM_CHAT_ID="your_chat_id" -
Run with Docker Compose
The bot can be configured through environment variables:
| ENV | Environment (development/production) | development |
| LOG_LEVEL | Logging level | debug |
| EXCHANGE_NAME | Exchange name | binance |
| EXCHANGE_API_KEY | API key | - |
| EXCHANGE_SECRET | API secret | - |
| EXCHANGE_TESTNET | Use testnet | true |
| TRADING_SYMBOL | Trading pair | BTCUSDT |
| BASE_AMOUNT | Base DCA amount | 100.0 |
| MAX_MULTIPLIER | Maximum position multiplier | 3.0 |
| TRADING_INTERVAL | Trading interval | 1h |
| PROMETHEUS_PORT | Prometheus metrics port | 8080 |
| HEALTH_PORT | Health check port | 8081 |
- Health Check: http://localhost:8081/health
- Prometheus Metrics: http://localhost:8080/metrics
- Grafana Dashboard: http://localhost:3000 (admin/admin123)
The bot implements an enhanced DCA strategy that:
- Analyzes multiple indicators to determine market conditions
- Calculates confidence scores based on indicator consensus
- Adjusts position sizes dynamically based on signal strength
- Enforces risk limits to protect capital
- Maintains minimum intervals between trades
- Buy Signal: When multiple indicators show oversold conditions
- Hold Signal: When indicators are neutral or conflicting
- Position Sizing: Based on confidence level and risk parameters
- Maximum 50% of balance per trade
- Configurable maximum position size
- Minimum balance thresholds
- Stop trading on low balance
The project follows clean architecture principles:
- Domain Layer: Core business logic (strategies, indicators)
- Application Layer: Use cases and orchestration
- Infrastructure Layer: External integrations (exchanges, notifications)
- Interface Layer: HTTP handlers and API endpoints
- Implement the TechnicalIndicator interface
- Add calculation logic
- Define buy/sell conditions
- Register in the strategy
- Implement the Exchange interface
- Add API integration
- Handle authentication
- Update configuration
For a detailed explanation of how technical indicators are integrated into this DCA bot, including RSI, SMA, and other indicators, check out our comprehensive article:
Integration of Technical Indicators into the DCA Bot: RSI, SMA, and etc.
This article provides in-depth analysis of the code implementation, strategy logic, and practical examples of how the bot makes trading decisions.
Ready to start trading with advanced bots? Try Bitsgap - a professional trading platform that offers:
- 7-day free trial of the PRO plan
- Advanced trading bots and strategies
- Multi-exchange trading
- Professional analytics and tools
Start your free trial with Bitsgap PRO
Get 7 days of PRO features completely free to explore advanced trading capabilities.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
This software is for educational and research purposes only. Cryptocurrency trading involves substantial risk of loss and is not suitable for all investors. The authors are not responsible for any financial losses incurred through the use of this software.
For questions and support:
- Create an issue on GitHub
- Check the documentation
- Review the configuration examples
Note: Always test thoroughly in a testnet environment before using real funds.
.png)

