6.5 KiB
Automation Features
This document describes the automation features added to the MQL5-Google-Onedrive repository.
Overview
A comprehensive automation system has been added to enable automatic startup of trading components on Windows, Linux, and WSL. This system eliminates manual startup procedures and ensures consistent initialization of all trading tools.
What's New
Scripts Added
-
scripts/startup_orchestrator.py- Advanced Python orchestrator for component management
- JSON-based configuration system
- Process monitoring and health checks
- Comprehensive logging with timestamps
- Dry-run mode for testing
- Cross-platform support (Windows, Linux, WSL)
-
scripts/startup.bat- Windows batch script for simple automation
- Automatic MT5 terminal detection
- Error handling and logging
- Task Scheduler compatible
-
scripts/startup.ps1- Advanced PowerShell automation script
- Scheduled task creation (
-CreateScheduledTaskflag) - Colored console output
- Administrator privilege handling
- Dry-run mode (
-DryRunflag) - Process verification
-
scripts/startup.sh- Linux/WSL bash script
- systemd service integration (
--setup-systemd) - Cron job setup (
--setup-cron) - WSL detection and Windows interop
- Wine support for MT5 on native Linux
-
scripts/example_custom_script.py- Template for user custom scripts
- Demonstrates proper logging
- Command-line argument parsing
- Task-based execution
Configuration
config/startup_config.json- Centralized configuration for all components
- Define startup order and delays
- Platform-specific component handling
- MT5 path configuration
- Notification settings (ready for future enhancement)
Documentation
-
docs/Startup_Automation_Guide.md- Complete automation guide
- Platform-specific instructions
- Configuration examples
- Troubleshooting section
- Security considerations
-
docs/Quick_Start_Automation.md- Quick reference for common commands
- One-command startup instructions
- Common troubleshooting
-
docs/Windows_Task_Scheduler_Setup.md- Detailed Windows Task Scheduler setup
- Manual and automated setup methods
- Testing and verification steps
- Export/import procedures
Other Changes
requirements.txt- Python dependencies (optional enhancements).gitignore- Updated to exclude logs, Python cache, and IDE filesREADME.md- Updated with automation quick start section
Features
Automated Startup Sequence
- Prerequisites check (Python, repository structure)
- Repository validation (optional)
- MT5 Terminal launch with proper initialization delay
- Custom script execution in configured order
- Process monitoring (optional)
- Comprehensive logging to
logs/directory
Multi-Platform Support
- Windows 10/11: Batch, PowerShell, Python
- Linux: Bash with systemd/cron
- WSL 1/2: Full Windows interop support
Flexible Configuration
- JSON-based component definition
- Per-component settings:
- Executable path
- Command-line arguments
- Working directory
- Initialization delay
- Required vs optional
- Platform restrictions
Auto-Start Integration
- Windows: Task Scheduler with automated setup
- Linux: systemd service with one-command install
- Linux: Cron job alternative
- Windows: Startup folder option
Logging & Monitoring
- Timestamped log files in
logs/directory - Component-level logging
- Success/failure tracking
- Process monitoring mode
- Colored console output (where supported)
Use Cases
-
Trading Workstation Auto-Start
- Start MT5 terminal on system boot
- Initialize custom trading scripts
- Validate repository before trading
-
Scheduled Trading Sessions
- Start trading components at specific times
- Automated pre-market checks
- Post-market cleanup routines
-
Development & Testing
- Consistent development environment setup
- Automated testing workflows
- CI/CD integration ready
-
Remote Trading Servers
- Unattended server operation
- Automatic recovery after reboot
- systemd service management
System Requirements
Minimum
- Python 3.8+
- Windows 10 / Linux (Ubuntu 20.04+) / WSL 2
- 4 GB RAM
- MT5 Terminal installed (for trading features)
Recommended
- Python 3.10+
- Windows 11 / Ubuntu 22.04 LTS
- 8 GB RAM
- SSD storage
- Stable internet connection
Quick Examples
Windows Quick Start
# One-time setup
powershell -ExecutionPolicy Bypass -File scripts\startup.ps1 -CreateScheduledTask
# Manual run
powershell -ExecutionPolicy Bypass -File scripts\startup.ps1
# Test run
powershell -ExecutionPolicy Bypass -File scripts\startup.ps1 -DryRun
Linux Quick Start
# One-time setup
./scripts/startup.sh --setup-systemd
# Manual run
./scripts/startup.sh
# Control service
sudo systemctl start mql5-trading-automation
sudo systemctl status mql5-trading-automation
Python Orchestrator
# Create config
python scripts/startup_orchestrator.py --create-config
# Run with monitoring
python scripts/startup_orchestrator.py --monitor 3600
# Dry run
python scripts/startup_orchestrator.py --dry-run
Security Notes
- Scripts never store sensitive credentials
- Task Scheduler credentials encrypted by Windows
- Scripts run with user privileges (not system)
- All configuration in version-controlled files
- Logs may contain execution details (review before sharing)
Future Enhancements
Planned features:
- Email/SMS notifications on startup failure
- Webhook integration (Slack, Discord, Telegram)
- ✅ Automatic retry on component failure (IMPLEMENTED)
- Health check API endpoint
- Web dashboard for monitoring
- Backup/restore configuration
- Multi-instance support
Troubleshooting
Common issues and solutions are documented in:
- Startup Automation Guide - Full troubleshooting section
- Quick Start - Common issues
Contributing
When adding new automation features:
- Update
startup_config.jsonwith sensible defaults - Add documentation to the guides
- Test on target platforms
- Update this FEATURES.md file
Support
- GitHub Issues: Report bugs or request features
- Email: Lengkundee01.org@domain.com
- WhatsApp: Agent community
License
Same as repository: See LICENSE