Complete guide to resolving common issues with the Advanced Forex Trading Engine.
python scripts/test_system.pyExpected output:
✅ System check passed
✅ Dependencies installed
✅ Configuration loaded
✅ MT5 connection available
✅ Risk management active
✅ Strategies loaded
Symptoms: ModuleNotFoundError or import errors
Solution:
# Update pip
pip install --upgrade pip
# Install dependencies with force
pip install -r requirements.txt --force-reinstall
# Check Python version (requires 3.11+)
python --versionSymptoms: "Failed to connect to MT5" or connection timeouts Solution:
- Verify MT5 is running
- Check terminal path in config:
broker:
terminal_path: "C:/MetaTrader5/terminal64.exe" # Update this path- Enable API trading in MT5:
- Tools → Options → Expert Advisors
- Enable "Allow automated trading"
- Enable "Allow DLL imports"
Symptoms: "Invalid configuration" or missing parameters Solution:
# Validate configuration
python -c "import yaml; yaml.safe_load(open('config/config.yaml'))"
# Check required fields
python scripts/validate_config.pySymptoms: System running but no positions opened Possible Causes:
-
Automated trading disabled
- Check MT5: AutoTrading button should be green
- Check EA settings: "Allow live trading" enabled
-
Symbol not in allowed list
- Check
AllowedSymbolsin configuration - Add your symbol to the list
- Check
-
Risk management blocking trades
- Check daily loss limits
- Check maximum positions
- Check drawdown limits
-
No signals generated
- Check strategy parameters
- Verify market data quality
- Check confidence thresholds
Solution:
# Enable debug logging
logging:
level: "DEBUG"
console: true
# Check signal generation
python scripts/debug_signals.pySymptoms: Positions closing quickly at stop loss Possible Causes:
-
Stop loss too tight
- Increase
DefaultStopLossPips - Use ATR-based stops
- Increase
-
High market volatility
- Reduce position sizes
- Use volatility-adjusted stops
-
Poor entry timing
- Review strategy logic
- Check market conditions
Solution:
stop_loss_take_profit:
default_stop_loss_pips: 30.0 # Increase from 20.0
use_dynamic_sltp: true # Enable dynamic stops
sl_multiplier: 1.0 # Increase multiplierSymptoms: Low win rate or negative returns Possible Causes:
-
Strategy overfitting
- Reduce strategy complexity
- Use walk-forward analysis
-
Market conditions changed
- Adapt strategy parameters
- Check market regime
-
Risk management too conservative
- Adjust position sizing
- Review risk parameters
Solution:
# Run strategy optimization
python scripts/optimize_strategies.py
# Analyze performance
python scripts/analyze_performance.pySymptoms: Compilation errors in MetaEditor Solution:
-
Check include files:
- Verify all
.mqhfiles are in Include folder - Check file paths in includes
- Verify all
-
Check syntax errors:
- Review error messages
- Fix syntax issues
-
Update MT5:
- Download latest MT5 version
- Restart MetaEditor
Symptoms: EA won't attach or shows errors Solution:
-
Check chart settings:
- Enable "Allow DLL imports"
- Enable "Allow external experts imports"
-
Check EA permissions:
- Right-click EA → Properties
- Enable "Allow live trading"
- Enable "Allow DLL imports"
-
Check symbol settings:
- Verify symbol is available
- Check symbol properties
Symptoms: EA attached but no trades Solution:
-
Check EA settings:
- Verify "Allow live trading" is enabled
- Check "AllowedSymbols" includes current symbol
-
Check account settings:
- Verify demo/live account selection
- Check leverage settings
-
Check risk settings:
- Review risk parameters
- Check position limits
Symptoms: System running slowly or freezing Solution:
# Reduce update frequency
data_provider:
update_interval: 5 # Increase from 1
# Optimize logging
logging:
level: "WARNING" # Reduce from INFO
console: false # Disable console outputSymptoms: Out of memory errors Solution:
# Reduce data cache
data_provider:
cache_data: false # Disable caching
historical_data_days: 7 # Reduce from 30
# Limit position tracking
position_management:
max_positions: 10 # Reduce from 20Symptoms: Delayed trade execution Solution:
- Use VPS for trading
- Optimize network connection
- Reduce strategy complexity
- Use ECN execution
Symptoms: Account losing money rapidly Solution:
# Reduce risk immediately
risk:
max_drawdown: 10.0 # Reduce from 20.0
daily_loss_limit: 5.0 # Reduce from 10.0
max_account_risk: 50.0 # Reduce from 95.0
trading:
max_positions: 5 # Reduce from 20
risk_per_trade: 2.0 # Reduce from 5.0Symptoms: "EMERGENCY STOP ACTIVE" message Solution:
- Check account balance
- Review recent trades
- Reset emergency stop:
# Reset emergency stop (use with caution)
risk_manager.reset_emergency_stop()Symptoms: "No data available" errors Solution:
- Check MT5 connection
- Verify symbol availability
- Check data provider settings
- Restart MT5
Symptoms: Backtesting fails or incomplete Solution:
# Download historical data
python scripts/download_data.py --symbols EURUSD,GBPUSD --days 365
# Verify data quality
python scripts/validate_data.pyEnable debug mode for detailed logging:
logging:
level: "DEBUG"
file: "logs/debug.log"
console: true
enable_performance_logging: trueRun comprehensive system check:
python scripts/system_diagnostics.pyProfile system performance:
python scripts/profile_performance.pyCheck network connectivity:
python scripts/network_test.pyMonitor system health:
# Check system status
system_status = trading_engine.get_system_status()
print(f"System Status: {system_status}")
# Check risk metrics
risk_metrics = risk_manager.get_risk_metrics()
print(f"Risk Metrics: {risk_metrics}")
# Check performance
performance = trading_engine.get_performance()
print(f"Performance: {performance}")Configure alerts for issues:
alerts:
enable_email_alerts: true
enable_sms_alerts: false
alert_thresholds:
drawdown_warning: 15.0
daily_loss_warning: 8.0
consecutive_losses_warning: 3
performance_warning: -5.0If system is causing issues:
# Emergency stop all trading
trading_engine.emergency_stop()
# Close all positions
position_manager.close_all_positions("EMERGENCY")
# Disable automated trading
trading_engine.disable_automated_trading()Reset system to safe state:
# Reset all components
trading_engine.reset_system()
# Clear all positions
position_manager.clear_all_positions()
# Reset risk management
risk_manager.reset_risk_limits()Recover from data corruption:
# Backup current data
python scripts/backup_data.py
# Restore from backup
python scripts/restore_data.py --backup latest
# Validate data integrity
python scripts/validate_data_integrity.py- Check this troubleshooting guide
- Run system diagnostics
- Collect error logs
- Document the issue
When reporting issues, include:
- Error messages (complete text)
- System logs (relevant sections)
- Configuration files (sanitized)
- Steps to reproduce
- Expected vs actual behavior
- Documentation: Complete Guide
- GitHub Issues: Report Bug
- GitHub Discussions: Ask Question
- Community: Join our trading community
- System logs:
logs/system.log - Trading logs:
logs/trading.log - Error logs:
logs/errors.log - Performance logs:
logs/performance.log
- Daily: Check system status and performance
- Weekly: Review logs and optimize settings
- Monthly: Update dependencies and backup data
- Quarterly: Full system audit and optimization
- Start with demo accounts
- Use conservative settings initially
- Monitor system continuously
- Keep backups of configurations
- Test changes before live use
- System running without errors
- MT5 connection stable
- Risk metrics within limits
- Performance meeting targets
- No unusual trading activity
- Logs clean and informative
For additional help, see Complete Documentation