From 13fe061245952357a92702bc25bbcfea93b01b10 Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Fri, 28 Nov 2025 19:43:42 +0100 Subject: [PATCH] refactor: Optimized for incremental calculation --- .../Ehlers/2_Oscillators/Laguerre_RSI_Pro.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Laguerre_RSI_Pro.md b/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Laguerre_RSI_Pro.md index d70d3a4..d2df6c9 100644 --- a/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Laguerre_RSI_Pro.md +++ b/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Laguerre_RSI_Pro.md @@ -1,4 +1,4 @@ -# Laguerre RSI Professional +# Laguerre RSI Pro ## 1. Summary (Introduction) @@ -47,8 +47,15 @@ The calculation is highly recursive, relying on the state of four internal filte ## 3. MQL5 Implementation Details * **Modular "Family" Architecture:** The core Laguerre filter calculation is encapsulated in a central `Laguerre_Engine.mqh` file. This engine is a **stateful class** that correctly maintains the state of its internal recursive components, ensuring a stable and accurate foundation. The `Laguerre_RSI_Calculator.mqh` is a thin adapter that uses this stable engine to generate the RSI. -* **Heikin Ashi Integration:** An inherited `CLaguerreEngine_HA` class allows the calculation to be performed seamlessly on smoothed Heikin Ashi data. -* **Stability via Full Recalculation:** We employ a full recalculation within `OnCalculate` for maximum stability. + +* **Optimized Incremental Calculation:** + Unlike basic implementations that recalculate the entire history on every tick, this indicator employs an intelligent incremental algorithm. + * It utilizes the `prev_calculated` state to determine the exact starting point for updates. + * **Persistent State:** The internal buffers (`m_L0`...`m_L3`) persist their state between ticks, allowing the recursive Laguerre algorithm to continue seamlessly from the last known value. + * This results in **O(1) complexity** per tick, ensuring instant updates and zero lag, even on charts with extensive history. + +* **Heikin Ashi Integration:** An inherited `CLaguerreEngine_HA` class allows the calculation to be performed seamlessly on smoothed Heikin Ashi data, leveraging the same optimized engine. + * **Value Clamping:** The final calculated value is mathematically clamped to the 0-100 range. ## 4. Parameters