From 3606bff97e6ab9cef4cbb18313c90745294838df Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Sun, 30 Nov 2025 11:48:15 +0100 Subject: [PATCH] refactor: Optimized for incremental calculation --- Indicators/MyIndicators/StochasticFast_Pro.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Indicators/MyIndicators/StochasticFast_Pro.md b/Indicators/MyIndicators/StochasticFast_Pro.md index 98b330f..a6fec0a 100644 --- a/Indicators/MyIndicators/StochasticFast_Pro.md +++ b/Indicators/MyIndicators/StochasticFast_Pro.md @@ -1,4 +1,4 @@ -# Fast Stochastic Professional +# Fast Stochastic Pro ## 1. Summary (Introduction) @@ -39,9 +39,13 @@ Our MQL5 implementation is a robust, unified indicator built on a modular, objec The entire calculation logic for both standard and Heikin Ashi versions is encapsulated within a single, powerful include file. * An elegant, object-oriented inheritance model (`CStochasticFastCalculator` and `CStochasticFastCalculator_HA`) allows the main indicator file to dynamically choose the correct calculation engine at runtime based on user input, eliminating code duplication. -* **Full MA Type Support:** The calculator contains a complete, robust implementation for all standard MQL5 MA types (SMA, EMA, SMMA, LWMA) for the "%D" signal line smoothing. +* **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 price buffers (`m_src_high`, etc.) persist their state between ticks. This allows the calculation to efficiently access historical data for the High/Low range search without re-copying the entire series. + * This results in **O(1) complexity** per tick, ensuring instant updates and zero lag, even on charts with extensive history. -* **Stability via Full Recalculation:** We employ a "brute-force" full recalculation within `OnCalculate` to ensure that the multi-stage calculation remains stable and accurate. +* **Full MA Type Support:** The calculator contains a complete, robust implementation for all standard MQL5 MA types (SMA, EMA, SMMA, LWMA) for the "%D" signal line smoothing. ## 4. Parameters