From 4e4aebb71a9ddd7f1672de5924cf1522f2faf68c Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Sun, 4 Jan 2026 16:36:18 +0100 Subject: [PATCH] refactor(indicators): Optimized for incremental calculation --- .../2_Oscillators/Inverse_Fisher_RSI_Pro.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Inverse_Fisher_RSI_Pro.md b/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Inverse_Fisher_RSI_Pro.md index 8c2731b..bf8fc5c 100644 --- a/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Inverse_Fisher_RSI_Pro.md +++ b/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Inverse_Fisher_RSI_Pro.md @@ -30,9 +30,21 @@ The indicator follows a multi-step process to transform a standard RSI. ## 3. MQL5 Implementation Details -* **Self-Contained Calculator (`Inverse_Fisher_RSI_Calculator.mqh`):** The entire multi-stage calculation, including the internal RSI and WMA, is encapsulated within a dedicated, reusable calculator class. -* **Heikin Ashi Integration:** An inherited `_HA` class allows the initial RSI calculation to be performed seamlessly on smoothed Heikin Ashi data. -* **Stability via Full Recalculation:** The indicator employs a full recalculation on every `OnCalculate` call to ensure the stateful RSI and WMA calculations are always perfectly synchronized and stable. +Our MQL5 implementation follows a modern, component-based, object-oriented design. + +* **Component-Based Design (Composition):** + The calculator (`Inverse_Fisher_RSI_Calculator.mqh`) orchestrates two powerful engines: + 1. **RSI Engine:** It reuses the `RSI_Pro_Calculator.mqh` to compute the base RSI. This ensures mathematical consistency with our standalone RSI indicator. + 2. **MA Engine:** It uses the `MovingAverage_Engine.mqh` to perform the WMA smoothing efficiently. + +* **Optimized Incremental Calculation (O(1)):** + Unlike basic implementations that recalculate the entire history on every tick, this indicator employs an intelligent incremental algorithm. + * **State Tracking:** It utilizes `prev_calculated` to process only new bars. + * **Persistent Buffers:** Internal buffers persist their state between ticks. + * **Robust Offset Handling:** The engine correctly handles the initialization periods of the chained calculations. + +* **Object-Oriented Logic:** + * The Heikin Ashi version (`CInverseFisherRSICalculator_HA`) is achieved simply by instructing the main calculator to instantiate the Heikin Ashi version of the RSI module. ## 4. Parameters