Article-22610-Joint-Recurre.../README.md

106 lines
4.1 KiB
Markdown
Raw Permalink Normal View History

2026-05-30 13:14:34 +05:00
Article-22610-Joint-Recurrence-Quantification-Analysis-MQL5
## Overview
Reference repository for the MQL5 article describing a Joint Recurrence Quantification Analysis (JRQA) extension to an existing RQA library. The article presents the JRQA concept, matrix construction, metric computation, rolling-window analysis, a facade API, and an indicator for live chart visualization.
JRQA differs from CRQA by detecting whether two systems simultaneously recur to their own past states at the same time indices. The resulting matrix is square, symmetric, and supports the full set of 12 recurrence metrics.
## Original Article
- **Article ID:** 22610
- **Author:** Hammad Dilber
- **Publication date:** 2026-05-29
- **Category:** Data Analysis
- **URL:** https://www.mql5.com/en/articles/22610
## Repository Purpose
This repository should be treated as a technical reference or reconstruction target for the JRQA additions described in the article.
Its purpose is to document the architecture and expected components of the JRQA layer for MQL5:
- joint recurrence matrix construction for two equal-length series
- extraction of JRQA metrics from the joint recurrence matrix
- rolling-window JRQA with OpenCL GPU acceleration and CPU fallback
- a facade class integrated into `RQA.mqh`
- an indicator plotting selected joint metrics in real time
## Key Concepts
- **JRQA vs CRQA:**
CRQA compares states of series X against states of series Y. JRQA checks whether X recurs to its own past and Y recurs to its own past at the same `(i, j)` indices.
- **Joint recurrence matrix:**
`JR(i, j) = 1` only if both self-recurrence conditions are satisfied.
- **Equal-length aligned series:**
JRQA requires matching time indices across both series.
- **Separate epsilons:**
The article supports `epsilonX` and `epsilonY`, with an overload for shared epsilon after normalization.
- **Supported metrics:**
JRR, JDET, JLAM, JTT, JL, JLmax, JVmax, JENTR, JDIV, JRATIO, JTREND, JCOMPLEXITY.
- **Rolling analysis:**
Windowed JRQA is described with GPU-first execution and automatic CPU fallback.
- **Indicator pipeline:**
Timestamp alignment, optional normalization, rolling computation, and plotting of selected metrics.
## Algorithm / Architecture Summary
The article describes the following architecture:
1. **`CJRQAMatrix`**
- Embeds two equal-length series using the same embedding parameters.
- Computes self-distances for each embedded series.
- Builds the `N x N` joint recurrence matrix by inline logical AND of the two threshold checks.
- Supports Euclidean, Manhattan, and Max norms.
2. **`CJRQAMetrics`**
- Scans the joint recurrence matrix.
- Counts diagonal and vertical line structures.
- Produces all 12 JRQA metrics in `SJRQAResult`.
3. **`CJRQAWindow`**
- Applies JRQA over rolling windows.
- Uses an OpenCL kernel for batched GPU processing when available.
- Falls back to a fused CPU implementation otherwise.
- Provides static extractors for selected metrics.
4. **`CJRQA` facade**
- Wraps matrix construction and metric computation.
- Exposes configuration such as embedding, norm, and one or two epsilon values.
- Provides a single `Compute()` workflow for two series.
5. **`JRQA_Indicator.mq5`**
- Compares the chart symbol with a second symbol.
- Aligns timestamps and applies optional normalization.
- Plots `JRR`, `JDET`, `JLAM`, `JENTR`, and `JTREND`.
## Mentioned or Attached Files
### Files mentioned in the article
- `RQA.mqh` — updated main include with JRQA facade support
- `JRQAMatrix.mqh``CJRQAMatrix` implementation
- `JRQAMetrics.mqh``CJRQAMetrics` and `SJRQAResult`
- `JRQAWindow.mqh``CJRQAWindow` with OpenCL and CPU fallback
- `JRQA_Indicator.mq5` — indicator plotting JRQA metrics
## Statistics
- **Article ID:** 22610
- **Sections:** 14
- **Mentioned files:** 5
- **Core classes described:** 4
- **JRQA metrics described:** 12
- **Indicator buffers plotted:** 5
## Tags
`mql5`, `rqa`, `jrqa`, `crqa`, `time-series`, `recurrence-analysis`, `quantitative-analysis`, `opencl`, `indicator`, `library`
## Difficulty
Advanced
## Reference
- Hammad Dilber, **“Joint Recurrence Quantification Analysis in MQL5”**, MQL5 Articles, 2026-05-29
https://www.mql5.com/en/articles/22610