refactor: Refactored to use Engines

This commit is contained in:
Toh4iem9
2025-12-25 11:09:47 +01:00
parent a1d1273deb
commit f11407caf9
@@ -6,7 +6,7 @@ The `MACD_Laguerre_Histogram_Pro` is the dedicated histogram component for our L
This indicator visually represents the convergence and divergence of momentum. The height and depth of the histogram bars provide an immediate sense of momentum acceleration and deceleration.
It is designed as a **companion indicator** to be overlaid in the same window as the `MACD_Laguerre_Line_Pro`. When their parameters are synchronized, they form a complete, modern, and highly responsive MACD system. The signal line's smoothing method is user-selectable, offering a choice between a **Laguerre filter** or one of the four standard moving average types (SMA, EMA, SMMA, LWMA).
It is designed as a **companion indicator** to be overlaid in the same window as the `MACD_Laguerre_Line_Pro`. When their parameters are synchronized, they form a complete, modern, and highly responsive MACD system. The signal line's smoothing method is user-selectable, offering a choice between a **Laguerre filter** or one of the **seven** standard moving average types.
## 2. Mathematical Foundations and Calculation Logic
@@ -27,13 +27,12 @@ To ensure perfect synchronization and accuracy without external dependencies, th
* **Self-Contained Calculation:** The indicator is fully self-contained. Its engine (`MACD_Laguerre_Histogram_Calculator.mqh`) internally recalculates the entire Laguerre MACD line using the `Laguerre_Engine`. This "shared engine" architecture avoids the instability of `iCustom` calls.
* **Optimized Incremental Calculation:**
* **Optimized Incremental Calculation (O(1)):**
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 Laguerre engines persist their state (`L0`...`L3`) between ticks, allowing the recursive calculation 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.
* **Flexible Signal Line Calculation:** The calculator dynamically instantiates either a third `Laguerre_Engine` or a `MovingAverage_Engine` for the signal line, depending on the user's choice. This ensures that the signal line calculation is also fully optimized and incremental.
* **Flexible Signal Line Calculation:** The calculator dynamically instantiates either a third `Laguerre_Engine` or a `MovingAverage_Engine` for the signal line. This allows for advanced smoothing types (like DEMA or TEMA) beyond the standard SMA.
* **Object-Oriented Design (Inheritance):** The standard `_HA` derived class architecture is used to seamlessly support calculations on Heikin Ashi price data.
@@ -42,7 +41,7 @@ To ensure perfect synchronization and accuracy without external dependencies, th
* **Laguerre MACD Settings:**
* **`InpGamma1` / `InpGamma2`:** The gamma coefficients for the two base Laguerre filters. The smaller value will be the fast filter, the larger will be the slow one.
* **Signal Line Settings:**
* **`InpSignalMAType`:** A dropdown menu to select the smoothing type for the signal line. Options include `Laguerre`, `SMA`, `EMA`, `SMMA`, `LWMA`.
* **`InpSignalMAType`:** A dropdown menu to select the smoothing type for the signal line. Options include `Laguerre`, `SMA`, `EMA`, `SMMA`, `LWMA`, `TMA`, `DEMA`, `TEMA`.
* **`InpSignalPeriod`:** The lookback period for **standard MA** signal lines.
* **`InpSignalGamma`:** The gamma coefficient used **only** if the signal line type is set to `Laguerre`.
* **Price Source:**