A high-performance algorithmic trading system for cryptocurrency markets, built in C++ with Binance integration.
- SMA - Simple Moving Average
- EMA - Exponential Moving Average
- RSI - Relative Strength Index
- MACD - Moving Average Convergence Divergence
- Bollinger Bands - Volatility bands with %B indicator
- MA Crossover - Golden/Death cross signals
- RSI Strategy - Mean reversion (buy oversold, sell overbought)
- MACD Strategy - Momentum crossover signals
- Bollinger Strategy - Mean reversion and breakout modes
- Confluence Strategy - Multi-indicator consensus (EMA + MACD + RSI)
- Backtest - Test strategies on historical data
- Paper Trading - Live data, simulated trades
- Web Dashboard - Real-time monitoring UI
| Feature | Data Source | API Keys Required |
|---|---|---|
| Market Data | Binance Mainnet (LIVE) | ❌ No |
| Paper Trading | Binance WebSocket (LIVE) | ❌ No |
| Dashboard | Real-time prices | ❌ No |
| Live Trading | Not implemented | ✅ Yes (future) |
Note: The bot uses real market data from Binance. All trades are simulated locally - no real money is involved.
The Confluence Strategy is designed for high-probability signals by requiring agreement from three different indicators:
-
Trend (EMA 50):
- Price > EMA = Bullish Bias (Only look for buys)
- Price < EMA = Bearish Bias (Only look for sells)
-
Momentum (MACD):
- MACD Line crosses above Signal Line = Buy Signal
- MACD Line crosses below Signal Line = Sell Signal
-
Validation (RSI):
- RSI < 70 (Buy): Ensures we aren't buying at the top
- RSI > 30 (Sell): Ensures we aren't selling at the bottom
Trade Entry: When ALL 3 conditions align. Trade Exit: When momentum reverses or RSI becomes extreme.
# Ubuntu/Debian
sudo apt update
sudo apt install -y build-essential cmake libcurl4-openssl-dev libssl-dev libboost-all-devgit clone https://github.com/ersbos/algorithmic-trading-cpp.git
cd algorithmic-trading-cpp
mkdir build && cd build
cmake ..
make -j$(nproc)
cd .../build/trading_bot --dashboard
# Open http://localhost:8080 in your browser./build/trading_bot --backtest --strategy rsi --period 30The dashboard provides real-time trading visualization:
./build/trading_bot --dashboardThen open http://localhost:8080 in your browser.
- 📈 Live price chart
- 🎛️ Strategy selector (MA, RSI, MACD, Bollinger, Confluence)
▶️ Start/Stop controls- 📊 Indicator values (RSI, MACD, Bollinger Bands)
- 📋 Trade history
- 💰 P&L tracking
# Test API connectivity
./build/trading_bot --test-connection
# Test WebSocket streaming
./build/trading_bot --test-websocket
# Backtest with different strategies
./build/trading_bot --backtest --strategy ma --period 30
./build/trading_bot --backtest --strategy rsi --period 30
./build/trading_bot --backtest --strategy macd --period 30
./build/trading_bot --backtest --strategy bollinger --period 30
./build/trading_bot --backtest --strategy confluence --period 30
# Paper trading (live data, simulated orders)
./build/trading_bot --paper --strategy rsi
# Web dashboard
./build/trading_bot --dashboardEdit config/config.json:
{
"trading": {
"symbol": "BTCUSDT",
"timeframe": "1h"
},
"strategy": {
"short_period": 9,
"long_period": 21
},
"backtest": {
"initial_capital": 10000.0
}
}cd build
ctest --output-on-failureAll 4 test suites: TestIndicators, TestStrategy, TestBacktest, TestNewIndicators
algoritmic_trading/
├── include/
│ ├── api/ # REST API server
│ ├── core/ # Config, logging, types
│ ├── data/ # Binance REST & WebSocket clients
│ ├── indicators/ # SMA, EMA, RSI, MACD, Bollinger
│ ├── strategy/ # Trading strategies
│ ├── backtest/ # Backtesting engine
│ └── execution/ # Order management
├── src/ # Implementation
├── web/ # Dashboard frontend
├── tests/ # Unit tests
└── config/ # Configuration files
- Core infrastructure (config, logging, types)
- Technical indicators (SMA, EMA, RSI, MACD, Bollinger)
- Strategies (MA Crossover, RSI, MACD, Bollinger, Confluence)
- Backtesting engine with performance metrics
- Binance REST client
- WebSocket for real-time data
- Paper trading mode
- Web dashboard
- Live trading with real orders
- Stop-loss / Take-profit automation
- Multiple symbol support
- Portfolio management
- Machine learning signals
MIT License