forked from animatedread/Warrior_EA
35 lines
2.2 KiB
Markdown
35 lines
2.2 KiB
Markdown
# Warrior_EA Main File (Warrior_EA.mq5)
| |||
| |||
## Overview
| |||
This is the main entry point for the Warrior EA. It orchestrates the initialization, configuration, and runtime logic for all subsystems, including database, signals, trailing stops, money management, and AI/ML integration.
| |||
| |||
## Key Responsibilities
| |||
- Includes and initializes all major subsystems (Database, Expert logic, Signals, Trailing, Money, Inputs, Variables).
| |||
- Handles robust initialization with retry logic for all critical components (signals, database, trailing, money management, indicators).
| |||
- Supports both traditional and AI/ML-driven signals, with dynamic feature toggles and modular filter integration.
| |||
- Manages event handlers for OnInit, OnDeinit, OnTick, OnTimer, and OnChartEvent.
| |||
- Integrates database ranking and periodic optimization via timer events.
| |||
| |||
## Initialization Flow
| |||
1. **Random Seed Initialization**: Ensures non-deterministic behavior for retries and randomization.
| |||
2. **Expert Initialization**: Robust retry logic for core expert logic.
| |||
3. **Signal Creation**: Modular, retry-based creation of all enabled signals and filters (AI/ML and traditional).
| |||
4. **Database Initialization**: Handles database versioning, folder structure, and error recovery.
| |||
5. **Filter and Signal Integration**: Dynamically attaches enabled filters/signals to the main signal pipeline.
| |||
6. **Trailing and Money Management**: Initializes and validates trailing stop and money management strategies.
| |||
7. **Settings and Indicator Validation**: Ensures all parameters and indicators are correctly configured.
| |||
8. **Timer Setup**: For periodic optimization and database ranking.
| |||
| |||
## Event Handlers
| |||
- `OnInit()`: Full initialization sequence.
| |||
- `OnTesterInit()`, `OnTesterDeinit()`: Backtesting/optimization hooks.
| |||
- `OnDeinit()`: Cleanup and resource release.
| |||
- `OnTick()`, `OnTimer()`, `OnChartEvent()`: Main runtime event handlers.
| |||
| |||
## Integration Notes
| |||
- Highly modular and robust against initialization failures.
| |||
- Designed for extensibility and future AI/ML-driven enhancements.
| |||
- All configuration is centralized via Inputs.mqh and Variables.mqh.
| |||
| |||
---
| |||
*Documented April 2026. For further details, see the main project documentation and AI_NETWORK.md.*
|