diff --git a/Indicators/MyIndicators/Authors/Ehlers/1_Smoothers/Ehlers_Smoother_Pro.mq5 b/Indicators/MyIndicators/Authors/Ehlers/1_Smoothers/Ehlers_Smoother_Pro.mq5 index dd8759d..260561c 100644 --- a/Indicators/MyIndicators/Authors/Ehlers/1_Smoothers/Ehlers_Smoother_Pro.mq5 +++ b/Indicators/MyIndicators/Authors/Ehlers/1_Smoothers/Ehlers_Smoother_Pro.mq5 @@ -3,7 +3,7 @@ //| Copyright 2025, xxxxxxxx| //+------------------------------------------------------------------+ #property copyright "Copyright 2025, xxxxxxxx" -#property version "2.20" // Adapted to new universal calculator +#property version "2.30" // Optimized for incremental calculation #property description "John Ehlers' SuperSmoother and UltimateSmoother filters." #property indicator_chart_window @@ -67,7 +67,18 @@ void OnDeinit(const int reason) } //+------------------------------------------------------------------+ -int OnCalculate(const int rates_total, const int, const datetime&[], const double &open[], const double &high[], const double &low[], const double &close[], const long&[], const long&[], const int&[]) +//| Custom indicator calculation function | +//+------------------------------------------------------------------+ +int OnCalculate(const int rates_total, + const int prev_calculated, // <--- Now used! + const datetime &time[], + const double &open[], + const double &high[], + const double &low[], + const double &close[], + const long &tick_volume[], + const long &volume[], + const int &spread[]) { if(CheckPointer(g_calculator) == POINTER_INVALID) return 0; @@ -78,7 +89,9 @@ int OnCalculate(const int rates_total, const int, const datetime&[], const doubl else price_type = (ENUM_APPLIED_PRICE)InpSourcePrice; - g_calculator.Calculate(rates_total, price_type, open, high, low, close, BufferFilter); +//--- Delegate calculation with prev_calculated optimization + g_calculator.Calculate(rates_total, prev_calculated, price_type, open, high, low, close, BufferFilter); + return(rates_total); } //+------------------------------------------------------------------+