160 lines
5.3 KiB
Markdown
160 lines
5.3 KiB
Markdown
# Article-22598-Market-Microstructure-GPH-ARFIMA-Estimator
|
|
|
|
This repository is an article-derived reference project based on the original MQL5 article. It does not claim to reproduce the full original source code unless files are explicitly attached.
|
|
|
|
## Overview
|
|
|
|
Reference/reconstruction repository for the MQL5 article describing the addition of a Geweke-Porter-Hudak (GPH) estimator and ARFIMA-oriented analysis to an existing market microstructure foundation header. The article extends a prior Hurst-analysis framework by estimating the fractional differencing parameter `d` from log-periodogram regression and validating it against previously computed Hurst values.
|
|
|
|
The implementation is described as modifications to an existing include file rather than a standalone new project.
|
|
|
|
## Original Article
|
|
|
|
- **Article ID:** 22598
|
|
- **Author:** Max Brown
|
|
- **Publication date:** 2026.05.27
|
|
- **Category:** Indicators
|
|
- **URL:** https://www.mql5.com/en/articles/22598
|
|
|
|
## Repository Purpose
|
|
|
|
This repository serves as a technical reference for reconstructing the article's described additions to `MicroStructure_Foundation.mqh`:
|
|
|
|
- `GPHEstimator()`
|
|
- `PopulateARFIMAAnalysis()`
|
|
|
|
It documents how the article integrates ARFIMA-style fractional differencing diagnostics into a shared `RobustFractalAnalysis` workflow, specifically by populating:
|
|
|
|
- `arfima_d`
|
|
- `arfima_confidence`
|
|
|
|
No claim is made that the full original repository or all article files are available here.
|
|
|
|
## Key Concepts
|
|
|
|
- Geweke-Porter-Hudak log-periodogram regression
|
|
- Fractional differencing parameter `d`
|
|
- Relationship between Hurst exponent and differencing:
|
|
- `d = H - 0.5`
|
|
- `H = d + 0.5`
|
|
- ARFIMA interpretation:
|
|
- `d > 0`: persistence / positive long memory
|
|
- `d = 0`: random-walk-like behavior
|
|
- `d < 0`: anti-persistence / mean reversion
|
|
- Confidence via regression `R²`
|
|
- Validation of `d` against previously computed Hurst outputs
|
|
- Session-level intraday analysis for US100 M1 data
|
|
|
|
## Algorithm / Architecture Summary
|
|
|
|
The article describes two additions to an existing header-only foundation.
|
|
|
|
### 1. `GPHEstimator(const double &returns[], int n, double &confidence)`
|
|
|
|
Purpose:
|
|
|
|
- Estimate fractional differencing parameter `d` directly from return series.
|
|
|
|
Method summary:
|
|
|
|
- Validate minimum bar count.
|
|
- Choose low-frequency bandwidth:
|
|
- `m = floor(N^g)`
|
|
- default exponent `g = 0.65`
|
|
- Compute the first `m` periodogram ordinates using a direct DFT.
|
|
- Regress:
|
|
- `log I(ω_j)` on `log |2 sin(ω_j / 2)|²`
|
|
- OLS slope gives `-d`, so:
|
|
- `d = -slope`
|
|
- Return regression `R²` as confidence.
|
|
- Clamp `d` to approximately `(-0.49, 0.49)`.
|
|
|
|
### 2. `PopulateARFIMAAnalysis(const string symbol, const int tf, const int period, RobustFractalAnalysis &result)`
|
|
|
|
Purpose:
|
|
|
|
- Fetch close prices
|
|
- Build filtered log-return array
|
|
- Call `GPHEstimator()`
|
|
- Store outputs into the shared result struct
|
|
- Perform H–d consistency diagnostics
|
|
|
|
Described validation flow:
|
|
|
|
- Validate symbol and minimum period
|
|
- Fetch closes via `SafeCopyClose()`
|
|
- Compute log returns
|
|
- Filter invalid prices and artifact returns above ±10%
|
|
- Require enough valid returns
|
|
- Compute `d` and confidence
|
|
- Compare implied `H = d + 0.5` against existing Hurst output when available
|
|
- Flag inconsistency if discrepancy exceeds threshold
|
|
- Mark low-confidence estimates as unreliable
|
|
|
|
### Constants added in the article
|
|
|
|
The article states that five constants are added to the existing header:
|
|
|
|
- `GPH_MIN_BARS`
|
|
- `GPH_BANDWIDTH_EXP`
|
|
- `GPH_MIN_FREQ`
|
|
- `GPH_CONF_THRESHOLD`
|
|
- `GPH_D_CONSISTENCY`
|
|
|
|
## Mentioned or Attached Files
|
|
|
|
### Explicitly attached files
|
|
|
|
No attached source files were available in the processed input.
|
|
|
|
### Files mentioned in the article text
|
|
|
|
- `MQL5/Indicators/HurstProfile/HurstProfile.mq5`
|
|
- `MQL5/Indicators/HurstProfile/Includes/MicroStructure_Foundation.mqh`
|
|
|
|
Also mentioned as existing dependencies or related functions/structures:
|
|
|
|
- `RobustFractalAnalysis`
|
|
- `PopulateHurstAnalysis()`
|
|
- `ValidateSymbolV2()`
|
|
- `SafeCopyClose()`
|
|
- `SafeLog()`
|
|
|
|
## Statistics
|
|
|
|
- **Series context:** Part 3 of a market microstructure series
|
|
- **Study sample:** 72 NY sessions
|
|
- **Instrument / timeframe:** US100 M1
|
|
- **Session window:** 09:30–16:00 ET
|
|
- **Pooled bars:** 27,930
|
|
- **Pooled GPH estimate:** `d = -0.006`
|
|
- **Implied pooled H:** `0.494`
|
|
- **Pooled regression confidence (`R²`):** `0.0001`
|
|
- **Session-level mean `d`:** `-0.016`
|
|
- **Session-level median `d`:** `-0.012`
|
|
- **Session-level standard deviation:** `0.153`
|
|
- **Interquartile range:** `[-0.124, 0.084]`
|
|
- **Regime breakdown:**
|
|
- `d < -0.1`: 21 sessions (29.2%)
|
|
- `-0.1 <= d <= 0.1`: 34 sessions (47.2%)
|
|
- `d > 0.1`: 17 sessions (23.6%)
|
|
|
|
## Tags
|
|
|
|
`mql5`, `market-microstructure`, `arfima`, `gph`, `hurst-exponent`, `fractional-differencing`, `spectral-analysis`, `time-series`
|
|
|
|
## Difficulty
|
|
|
|
Intermediate to advanced.
|
|
|
|
## Limitations
|
|
|
|
- The full original source code repository is unavailable from the provided input.
|
|
- No attached `.mq5` or `.mqh` files were included in the processed input.
|
|
- This README is based on article content and code excerpts only.
|
|
- Metadata such as author, publication date, and category were not provided in the input and therefore cannot be verified here.
|
|
- The project appears to be an incremental modification of an existing codebase from earlier articles, so it is not self-contained from this article alone.
|
|
|
|
## Reference
|
|
|
|
Original article: https://www.mql5.com/en/articles/22598
|