diff --git a/Indicators/MyIndicators/Authors/Ehlers/5_Ehlers_Hybrids/EScore_Pro.md b/Indicators/MyIndicators/Authors/Ehlers/5_Ehlers_Hybrids/EScore_Pro.md index feb22c4..fcfa8d4 100644 --- a/Indicators/MyIndicators/Authors/Ehlers/5_Ehlers_Hybrids/EScore_Pro.md +++ b/Indicators/MyIndicators/Authors/Ehlers/5_Ehlers_Hybrids/EScore_Pro.md @@ -4,7 +4,7 @@ **E-Score Pro** is an advanced, high-performance separate window oscillator that measures the statistical deviation of the current price from John Ehlers' low-lag filters (either the `SuperSmoother` or `UltimateSmoother`). Rather than relying on simple linear distance, it normalizes price deviation into units of rolling standard deviation (Z-Score), delivering a dimensionless, scale-free momentum tool. -To mitigate the high-frequency noise inherent in ultra-responsive filters, `E-Score Pro` incorporates a smoothed **Exponential Moving Average (EMA) Signal Line**, while maintaining a highly expressive **5-Zone Thermal Color Histogram** for regime identification. +To mitigate the high-frequency noise inherent in ultra-responsive filters, `E-Score Pro` incorporates an optional, highly customizable **Signal Line** selectable from any of the dynamic moving average types inside the `MovingAverage_Engine.mqh` library, while maintaining a highly expressive **5-Zone Thermal Color Histogram** for regime identification. The indicator is fully integrated with Heikin Ashi price sources, maintaining strict definition-truth and incremental $O(1)$ calculation efficiency. @@ -26,41 +26,62 @@ $$\sigma_t = \sqrt{\frac{1}{W} \sum_{k=0}^{W-1} (P_{t-k} - S_{t-k})^2}$$ * $S_t$ is computed using either Ehlers' 2-pole `SuperSmoother` or `UltimateSmoother` coefficients, which filter out high-frequency noise while minimizing group delay in the passband. -### B. EMA Signal Line Formula +### B. Universal Signal Line Formula -To filter out minor oscillations, an Exponential Moving Average (EMA) is applied to the E-Score output over a smoothing period $P_{\text{sig}}$ (`InpSignalPeriod`): +To filter out minor oscillations, any of the integrated moving average types can be applied to the E-Score output over a smoothing period $P_{\text{sig}}$ (`InpSignalPeriod`): -$$\text{Signal}_t = (\text{E-Score}_t \times \alpha) + (\text{Signal}_{t-1} \times (1 - \alpha))$$ +$$\text{Signal}_t = \text{MA}(\text{E-Score}_t, P_{\text{sig}}) \quad \text{using selected MA Type}$$ -$$\alpha = \frac{2}{P_{\text{sig}} + 1}$$ +* If **`VWMA`** is selected as the Signal Line type, the calculations are automatically weighted by the market volume, utilizing a double-precision volume translation pipeline. --- -## 3. MQL5 Implementation Details +## 3. Advanced MQL5 Implementation & Volume Alignment -* **Modularity and Composition:** - The mathematical engine is encapsulated in `EScore_Calculator.mqh` via the class `CEScoreCalculator`. It embeds the `CEhlersSmootherCalculator` class (composition over inheritance) and manages internal Heikin Ashi buffers (`CHeikinAshi_Calculator`) internally, keeping the visual wrapper `EScore_Pro.mq5` incredibly lightweight. +### A. Dynamic Volume-Weighted Signal Pipeline -* **Strict $O(1)$ Incremental Calculation:** - The calculator uses the platform's `prev_calculated` parameter to process only the newest incoming bar on every tick. It resizes dynamic arrays on startup and performs rolling calculations efficiently without historical loops, ensuring ultra-low latency. +Volume-weighted calculations (like VWMA) require double-precision volume data. The standard MQL5 `OnCalculate` provides volumes as integer arrays (`long volume[]`). +`E-Score Pro` implements an automatic high-performance conversion pipeline. It detects whether real or tick volumes are available, converts them incrementally ($O(1)$ complexity) to a global double array (`g_double_volume[]`), and forwards them to the Signal Line calculator: -* **5-Zone Thermal Color Scheme:** - Visualized as a color histogram to easily isolate structural regimes: - * **Bull Extreme ($\ge 2.0$):** OrangeRed (Extreme overbought / exhaustion). - * **Bull Flow ($\ge 1.5$):** Coral (Strong upward momentum). - * **Neutral ($[-1.5, 1.5]$):** Gray (Noise / consolidation). - * **Bear Flow ($\le -1.5$):** LightSkyBlue (Strong downward momentum). - * **Bear Extreme ($\le -2.0$):** DeepSkyBlue (Extreme oversold / potential bounce). +```mql5 +g_signal_calculator.CalculateOnArray(rates_total, prev_calculated, ExtEScoreBuffer, g_double_volume, ExtSignalBuffer, InpPeriod); +``` + +This enables full volume-weighted statistical capabilities on custom arrays without sacrificing execution speed. + +### B. MT5 Plot Persistency and Data Window Cleanup + +MT5 is stateful; if an indicator disables a plot dynamically, the plot's draw style can remain corrupted upon re-initialization. `E-Score Pro` resolves this by explicitly overriding plot properties inside `OnInit()`. +Additionally, when `InpShowSignal` is toggled `false`, the indicator dynamically nullifies the plot label: + +```mql5 +PlotIndexSetString(1, PLOT_LABEL, NULL); +``` + +This completely purges the disabled Signal Line from the MT5 Data Window, keeping the user interface and data outputs perfectly clean. + +### C. Strict $O(1)$ Incremental Calculation + +The calculator uses the platform's `prev_calculated` parameter to process only the newest incoming bar on every tick. It resizes dynamic arrays on startup and performs rolling calculations efficiently without historical loops, ensuring ultra-low latency. --- ## 4. Parameters +### A. Core E-Score Settings + * `InpSmootherType`: Select between **SUPERSMOOTHER** or **ULTIMATESMOOTHER** as the baseline central curve. + * `InpPeriod`: The lookback window ($W$) for the standard deviation calculation (Default: `20` bars). -* `InpSignalPeriod`: The smoothing window for the EMA Signal Line (Default: `5` bars). * `InpSourcePrice`: The applied price source (supports Standard and Heikin Ashi prices). +### B. Signal Line Settings + +* `InpShowSignal`: Toggle to enable/disable the Signal Line on the chart and Data Window (Default: `true`). + +* `InpSignalPeriod`: The lookback period for the Signal Line MA (Default: `5` bars). +* `InpSignalType`: Select the MA type for the Signal Line (Default: `SMA`). + --- ## 5. Quantitative Analysis & Insights (V-Score vs. E-Score) @@ -77,4 +98,4 @@ Through rigorous live market testing on major currency pairs (such as `EURUSD`) * **Ehlers Smoother Behavior:** SuperSmoother is designed with almost zero group delay. It hugs the price curve closely, adapting to almost every minor swing. * **Z-Score Impact:** Because the purple smoother curve is extremely close to the price, the numerator ($Price - Smoother$) is tiny and fluctuates rapidly. This tiny numerator divided by an equally tiny rolling standard deviation amplifies minor price ticks, resulting in a jagged, noisy, high-frequency oscillator. -* **Usage:** E-Score is not suitable for tracking macro trends, but is a highly responsive **Short-Term Momentum Cycle Oscillator** (Micro-scale / Rate-of-Change proxy). The addition of the EMA Signal Line is highly recommended to filter out the high-frequency noise and capture clean momentum crosses. +* **Usage:** E-Score is not suitable for tracking macro trends, but is a highly responsive **Short-Term Momentum Cycle Oscillator** (Micro-scale / Rate-of-Change proxy). The addition of the Signal Line is highly recommended to filter out the high-frequency noise and capture clean momentum crosses.