diff --git a/Indicators/MyIndicators/SMI_Pro.mq5 b/Indicators/MyIndicators/SMI_Pro.mq5 index 5afab87..3c1c232 100644 --- a/Indicators/MyIndicators/SMI_Pro.mq5 +++ b/Indicators/MyIndicators/SMI_Pro.mq5 @@ -1,11 +1,9 @@ //+------------------------------------------------------------------+ //| SMI_Pro.mq5| //| Copyright 2025, xxxxxxxx| -//| | //+------------------------------------------------------------------+ #property copyright "Copyright 2025, xxxxxxxx" -#property link "" -#property version "3.00" +#property version "3.01" // Optimized for incremental calculation #property description "Professional Stochastic Momentum Index (SMI) with a signal line and" #property description "selectable candle source (Standard or Heikin Ashi)." @@ -113,7 +111,7 @@ void OnDeinit(const int reason) //| Custom indicator calculation function. | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, - const int prev_calculated, + const int prev_calculated, // <--- Now used! const datetime &time[], const double &open[], const double &high[], @@ -123,14 +121,13 @@ int OnCalculate(const int rates_total, const long &volume[], const int &spread[]) { -//--- Ensure the calculator object is valid if(CheckPointer(g_calculator) == POINTER_INVALID) return 0; -//--- Delegate the entire calculation to our calculator object - g_calculator.Calculate(rates_total, open, high, low, close, BufferSMI, BufferSignal); +//--- Delegate calculation with prev_calculated optimization + g_calculator.Calculate(rates_total, prev_calculated, open, high, low, close, + BufferSMI, BufferSignal); -//--- Return rates_total for a full recalculation, ensuring stability return(rates_total); } //+------------------------------------------------------------------+