HourlyDD Logger by SQXHK
- Utilitaires
- Version: 1.0
SQXHK presents
MetaTrader 5 Expert Advisor: Hourly Equity & Drawdown Data Logger
Developer: SQX.hk
Visit SQX.hk for data science trading skills course using "StrategyQuant X" and AI Data Science platform "Tradotcom.com"!
This MQL5 script functions as an automated data-logging Expert Advisor (EA) designed to capture intraday equity metrics directly from MetaTrader 5 and export them into structured CSV files . It records hourly snapshots of account performance, high-water marks, and equity drawdowns in real-time .
Script Architecture & Functionality
-
Initialization ( OnInit ): Captures the current account equity and login ID, setting the baseline high-water mark . Generates a unique CSV filename embedded with the account number and precise deployment timestamp .
-
Real-Time Data Capture ( OnTick ): Evaluates tick data and triggers exact top-of-the-hour recording ( minute == 0 ) . Automatically updates peak equity (high-water mark) and tracks both current drawdown and maximum peak-to-trough drawdown .
-
Thread-Safe File Handling: Utilizes non-blocking file access ( FILE_SHARE_READ | FILE_SHARE_WRITE ) to open, append, and close logs dynamically . Allows external Python scripts, SQL pipelines, or data visualization engines to read the dataset live without disrupting trade execution .
The Power of Data Science in the MT5 EA Market (SQX.hk Methodology)
Most retail traders evaluate Expert Advisors using surface-level metrics (e.g., total profit or terminal drawdowns). At SQX.hk, students learn to move beyond static backtests and harness the true power of Data Science for Quantitative Trading:
-
Bridging MT5 to Python/R Pipelines: By automatically converting live broker telemetry into clean CSV files, this script bridges MQL5 execution with external data science toolkits .
-
Continuous Intraday Risk Analytics: Static equity charts mask hidden intraday volatility. Continuous hourly drawdown logging equips students to calculate advanced quantitative metrics—such as Hourly Ulcer Index, Time-in-Drawdown Duration, and Intraday Tail-Risk Distributions.
-
Robustness & Machine Learning Integration: SQX.hk trains students to leverage raw market logs for data-driven modeling—enabling automated strategy clustering, Monte Carlo stress testing, and real-time risk control models that adapt to changing market regimes.
Remarks:
This EA is to be used with "SQXHK Data Visualization Tools (Python) 數據視覺分析" offered during SQXHK StrategyQuant MasterClass lesson, and for various Data Science projects.
Visit SQX.hk and join our Whatsapp community!
