diff --git a/Indicators/MyIndicators/StochRSI_Slow_Pro.mq5 b/Indicators/MyIndicators/StochRSI_Slow_Pro.mq5 index 1d3364a..fab2a6d 100644 --- a/Indicators/MyIndicators/StochRSI_Slow_Pro.mq5 +++ b/Indicators/MyIndicators/StochRSI_Slow_Pro.mq5 @@ -1,10 +1,9 @@ //+------------------------------------------------------------------+ //| StochRSI_Slow_Pro.mq5| //| Copyright 2025, xxxxxxxx| -//| | //+------------------------------------------------------------------+ #property copyright "Copyright 2025, xxxxxxxx" -#property version "3.00" +#property version "3.10" // Optimized for incremental calculation #property description "Professional Slow Stochastic RSI with selectable MA types and" #property description "price source (Standard or Heikin Ashi)." @@ -101,9 +100,18 @@ void OnDeinit(const int reason) } //+------------------------------------------------------------------+ -//| Custom indicator iteration function. | +//| Custom indicator calculation function | //+------------------------------------------------------------------+ -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&[]) +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; @@ -114,7 +122,8 @@ int OnCalculate(const int rates_total, const int, const datetime&[], const doubl else price_type = (ENUM_APPLIED_PRICE)InpSourcePrice; - g_calculator.Calculate(rates_total, open, high, low, close, price_type, BufferK, BufferD); +//--- Delegate calculation with prev_calculated optimization + g_calculator.Calculate(rates_total, prev_calculated, open, high, low, close, price_type, BufferK, BufferD); return(rates_total); }