From f87c2666401dbde02bfb95e02ac86b4194434c2b Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Sat, 3 Jan 2026 10:02:35 +0100 Subject: [PATCH] docs(indicators): Optimized for incremental calculation --- .../Kaufman/Polynomial_Regression_Slope_Pro.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Indicators/MyIndicators/Authors/Kaufman/Polynomial_Regression_Slope_Pro.md b/Indicators/MyIndicators/Authors/Kaufman/Polynomial_Regression_Slope_Pro.md index b22a573..19947ff 100644 --- a/Indicators/MyIndicators/Authors/Kaufman/Polynomial_Regression_Slope_Pro.md +++ b/Indicators/MyIndicators/Authors/Kaufman/Polynomial_Regression_Slope_Pro.md @@ -35,16 +35,22 @@ This final `Slope_t` value is what is plotted on the chart for bar `t`. ## 3. MQL5 Implementation Details -* **Self-Contained Calculation Engine (`Polynomial_Regression_Slope_Calculator.mqh`):** The entire multi-stage calculation logic is encapsulated within a single, dedicated include file. The engine is a streamlined version of the channel calculator, focused only on calculating the `b` and `c` coefficients to derive the slope. +Our MQL5 implementation follows a modern, object-oriented design to ensure stability and performance. -* **Moving Window Calculation:** The calculator iterates through the entire price history. For each bar, it performs a full polynomial regression calculation on the preceding `N` bars to determine the historical slope value at that specific point in time. +* **Self-Contained Calculation Engine (`Polynomial_Regression_Slope_Calculator.mqh`):** The entire multi-stage calculation logic is encapsulated within a single, dedicated include file. + +* **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:** The internal price buffer persists its state between ticks. + * **Efficiency:** The calculator efficiently updates the regression slope for each new bar without re-processing the entire history. * **Object-Oriented Design (Inheritance):** The standard `_HA` derived class architecture is used to seamlessly support calculations on Heikin Ashi price data. ## 4. Parameters * **Period (`InpPeriod`):** The lookback period for the regression calculation. A larger period will result in a smoother, slower oscillator, while a shorter period will be more responsive. Default is `50`. -* **Applied Price (`InpSourcePrice`):** The source price for the calculation (Standard or Heikin Ashi). +* **Applied Price (`InpSourcePrice`):** The source price for the calculation. (Standard or Heikin Ashi). ## 5. Usage and Interpretation