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.
- 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