An automated cryptocurrency trading bot that implements Inner Circle Trader (ICT) and Smart Money Concepts (SMC) strategies on Binance. Built with Lumibot and the SmartMoneyConcepts library.
This bot uses institutional trading concepts to identify high-probability trading opportunities in cryptocurrency markets. It detects key market structures like Order Blocks, Fair Value Gaps, and Break of Structure patterns to make informed trading decisions.
-
Smart Money Concepts Integration
- Order Blocks (OB) detection
- Fair Value Gaps (FVG) identification
- Break of Structure (BOS) and Change of Character (CHoCH) signals
- Swing High/Low detection
- Discount/Premium zone analysis
-
Advanced Risk Management
- Configurable position sizing
- Maximum concurrent positions limit
- Risk:Reward ratio enforcement
- Daily loss limits
- Stop-loss and take-profit management
-
Multiple Trading Modes
- Backtesting with historical data
- Paper trading (simulated)
- Live trading on Binance
-
Robust Architecture
- YAML-based configuration system
- Comprehensive logging and error handling
- API error recovery with retry mechanism
- Performance tracking and metrics
The bot enters long positions when ALL of the following conditions are met:
- Price is in the discount zone (below 50% of recent range)
- Bullish Order Block is present
- Fair Value Gap detected (optional)
- Bullish Break of Structure confirmed (optional)
- Price reaches premium zone (above 50%)
- Stop loss hit (below order block low)
- Take profit based on risk:reward ratio
- Python 3.8+
- Binance account with API credentials
- Required Python packages (see
requirements.txt)
-
Clone the repository
git clone <your-repo-url> cd "ICT SMC BOT"
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
- Copy
.env.exampleto.env - Add your Binance API credentials to
.env
cp .env.example .env # Edit .env with your credentials - Copy
-
Configure your strategy
- Edit
config_backtest.yamlfor backtesting - Create
config_paper.yamlfor paper trading - Create
config_live.yamlfor live trading
- Edit
BINANCE_API_KEY=your_api_key_here
BINANCE_API_SECRET=your_api_secret_hereKey configuration sections:
- binance: API settings and rate limits
- trading: Symbol, timeframe, lookback period
- risk_management: Position sizing, stop loss, take profit
- smc_indicators: Enable/disable specific SMC indicators
- logging: Log level and output settings
See config_backtest.yaml for detailed configuration options.
Run historical backtests to evaluate strategy performance:
from lumibot.backtesting import YahooDataBacktesting
from datetime import datetime
from ict_strategy_template import ICTStrategy
ICTStrategy.backtest(
YahooDataBacktesting,
backtesting_start=datetime(2024, 1, 1),
backtesting_end=datetime(2024, 12, 31),
budget=10000,
benchmark_asset="SPY"
)Test your strategy with simulated trading:
from lumibot.brokers import Ccxt
from lumibot.traders import Trader
from config import load_config
from ict_strategy_template import ICTStrategy
# Load paper trading config
config = load_config(mode='paper')
broker_config = config.binance.get_broker_config()
# Initialize broker and strategy
broker = Ccxt(broker_config)
strategy = ICTStrategy(broker=broker)
# Run paper trading
trader = Trader()
trader.add_strategy(strategy)
trader.run_all()WARNING: Live trading involves real money. Use at your own risk!
- Ensure you have sufficient funds in your Binance account
- Test thoroughly in paper trading mode first
- Start with small position sizes
- Monitor the bot closely during initial live runs
# In ict_strategy_template.py, change mode to 'live'
config = load_config(mode='live')
# Then run the bot
python ict_strategy_template.pyICT SMC BOT/
├── ict_strategy_template.py # Main strategy implementation
├── config.py # Configuration management
├── config_backtest.yaml # Backtest configuration
├── logger.py # Logging utilities
├── error_recovery.py # Error handling and retry logic
├── data_mapper.py # Data format conversion
├── requirements.txt # Python dependencies
├── .env # Environment variables (not in git)
├── .env.example # Environment template
├── logs/ # Log files directory
└── README.md # This file
IMPORTANT: This bot is provided for educational purposes only.
- Cryptocurrency trading carries substantial risk
- Past performance does not guarantee future results
- Never trade with money you cannot afford to lose
- Always test thoroughly in paper trading mode first
- The authors are not responsible for any financial losses
The bot creates detailed logs in the logs/ directory:
- Trade execution logs
- Signal generation logs
- Performance metrics
- Error and exception logs
Monitor these logs regularly to ensure the bot is operating as expected.
API Connection Errors
- Verify your API credentials in
.env - Check if your IP is whitelisted on Binance
- Ensure API has necessary permissions (read + trade)
Insufficient Data Errors
- Increase
lookback_periodin config - Check if the trading pair has enough historical data
Order Execution Failures
- Verify you have sufficient balance
- Check position size calculations
- Review Binance API rate limits
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Test your changes thoroughly
- Submit a pull request
This project is provided as-is for educational purposes. Use at your own risk.
For issues and questions:
- Open an issue on GitHub
- Review existing documentation
- Check logs for detailed error messages
Remember: Always practice proper risk management and never invest more than you can afford to lose.