Advanced algorithmic trading system for futures markets with pattern recognition, risk management, and real-time execution capabilities.
Professional-grade automated trading platform built for NQ, ES, and CL futures contracts. Features sophisticated pattern detection algorithms, comprehensive risk management, and real-time market analysis.
Performance: Backtested pattern recognition achieving 89.5% win rate on S/R bounce patterns across 247+ historical trades.
Backend: Python 3.10+, asyncio for concurrent operations
Trading API: TopStepX Direct API integration
Data Processing: Pandas, NumPy for market analysis
Real-time: WebSocket connections for live market data
Communication: Slack integration for monitoring & alerts
Web Dashboard: React, Node.js, real-time updates
Database: SQLite for pattern storage & trade logging
- S/R Bounce Detection - Support/resistance level identification
- Fair Value Gap (FVG) Analysis - ICT-based pattern detection
- Market Regime Classification - Trend, range, breakout identification
- Volume Confirmation - 1.2x average volume threshold validation
- Max Daily Loss Limits - Configurable stop-loss per day
- Position Sizing - Dynamic risk calculation per trade
- Max Concurrent Positions - Prevent overexposure
- Stop After Losses - Auto-halt after consecutive losses
- Real-time P&L Tracking - Live profit/loss monitoring
- Multi-Bot Architecture - ES, NQ, CL specialized bots
- Order Management - Market orders with slippage control
- Position Monitoring - Real-time position tracking
- Automated Entry/Exit - Rule-based execution
- Conflict Detection - Prevents duplicate orders
- Web Dashboard - Real-time trading dashboard
- Slack Notifications - Trade alerts and system status
- Performance Metrics - Win rate, P&L, drawdown analysis
- Pattern Validation - Out-of-sample testing
- Trade Logging - Complete audit trail
xtrading/
βββ trading_bot/ # Core trading engine
β βββ strategy/ # Pattern detection algorithms
β βββ execution/ # Order management
β βββ risk/ # Risk management
βββ es_bot/ # E-mini S&P 500 bot
βββ nq_bot/ # E-mini NASDAQ bot
βββ cl_bot/ # Crude Oil bot
βββ patterns/ # Pattern recognition modules
βββ shared/ # Common utilities
βββ web_platform/ # React dashboard
βββ tests/ # Unit & integration tests
- Python 3.10+
- TopStepX API credentials
- Node.js 16+ (for web dashboard)
# Clone repository
git clone https://github.com/SamShahinDev/algorithmic-trading-platform.git
cd algorithmic-trading-platform
# Install Python dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your API credentials
# Run tests
python -m pytest tests/# Start single bot (paper trading)
python run_nq_bot.py
# Start all bots
python run_all_bots.py
# Start with web dashboard
cd web_platform && npm install && npm start
python run_all_bots.pyThe system identifies high-probability setups using:
- Support/Resistance Bounces - Price rejection at key levels
- Fair Value Gaps - Imbalances in price action
- Volume Confirmation - Above-average volume validation
- Market Structure - Trend alignment
- Pattern confirmation with volume
- Risk/reward ratio minimum 2:1
- Market conditions favorable (regime check)
- No conflicting signals from other patterns
- Profit target: 5 points (NQ), 4 points (ES)
- Stop loss: 3 points (NQ), 2.5 points (ES)
- Trailing stops for extended moves
- Time-based exits for stale positions
- Maximum 5 trades per day
- Stop trading after 2 consecutive losses
- Max daily loss: $1,000 (configurable)
- Position size: 1 contract per trade
- Paper Trading Ready - Test strategies risk-free
- API Key Protection - Environment variable storage
- Rate Limiting - Prevents API throttling
- Position Verification - Double-check before orders
- Emergency Flatten - Quick position liquidation
- Lock Files - Prevents duplicate bot instances
Backtested Results (2024 Q3-Q4):
- Win Rate: 89.5% on S/R bounce pattern
- Total Trades: 247
- Average Win: +$120
- Average Loss: -$85
- Max Drawdown: $680
Note: Past performance does not guarantee future results. All statistics are from backtested data.
# Run all tests
python -m pytest tests/ -v
# Test specific bot
python test_nq_bot.py
# Backtest patterns
python validate_patterns_q3q4_2024.py
# Test API connection
python test_topstepx_connection.pyEdit .env file for customization:
# Trading parameters
MAX_DAILY_LOSS=1000
MAX_POSITIONS=2
RISK_PER_TRADE=0.01
# Bot behavior
TRADING_MODE=demo # or 'live'
LOG_LEVEL=INFOFOR EDUCATIONAL AND PORTFOLIO DEMONSTRATION PURPOSES ONLY
This software is provided for educational purposes to demonstrate algorithmic trading concepts, system architecture, and software engineering practices.
- Not financial advice
- Trading involves substantial risk of loss
- Past performance does not guarantee future results
- Always test thoroughly in paper trading before live deployment
- Consult licensed professionals before trading
- Python - Core language
- TopStepX API - Futures trading platform
- Pandas/NumPy - Data analysis
- React - Web dashboard
- Slack API - Notifications
- Pytest - Testing framework
Hussam Shahin
LinkedIn | GitHub
Status: Portfolio demonstration project showcasing quantitative trading system development, pattern recognition algorithms, and real-time market data processing.