From 672f436a22aa47c81e2441cb451e177fbcbf28e9 Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Tue, 30 Jun 2026 14:21:45 +0200 Subject: [PATCH] refactor: Upgraded with 3-digit Gamma precision and strict chronological state safety --- .../2_Oscillators/Laguerre_Stoch_Fast_Pro.mq5 | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Laguerre_Stoch_Fast_Pro.mq5 b/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Laguerre_Stoch_Fast_Pro.mq5 index d9d1cbf..9f20ce2 100644 --- a/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Laguerre_Stoch_Fast_Pro.mq5 +++ b/Indicators/MyIndicators/Authors/Ehlers/2_Oscillators/Laguerre_Stoch_Fast_Pro.mq5 @@ -3,7 +3,7 @@ //| Copyright 2026, xxxxxxxx| //+------------------------------------------------------------------+ #property copyright "Copyright 2026, xxxxxxxx" -#property version "1.10" // Upgraded with dynamic volume routing to support VWMA Signals +#property version "1.20" // Upgraded with 3-digit Gamma precision and strict chronological state safety #property description "Laguerre Stochastic Fast. Calculates Fast Stochastic directly" #property description "from the internal state variables (L0-L3) of the Laguerre Filter." @@ -39,12 +39,12 @@ //--- Input Parameters input group "Laguerre Settings" -input double InpGamma = 0.7; -input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD; +input double InpGamma = 0.7; // Gamma (0.0 - 1.0, e.g. 0.236, 0.382) +input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD; // Price Source input group "Signal Line Settings" -input int InpSignalPeriod = 3; -input ENUM_MA_TYPE InpSignalMethod = SMA; +input int InpSignalPeriod = 3; // Period (if MA) +input ENUM_MA_TYPE InpSignalMethod = SMA; // Method (if MA / VWMA) //--- Buffers double BufferStoch[]; @@ -77,9 +77,9 @@ int OnInit() return(INIT_FAILED); } -//--- Shortname +//--- Shortname - Updated format string to %.3f to support exact Fibonacci decimals string type = (InpSourcePrice <= PRICE_HA_CLOSE) ? " HA" : ""; - IndicatorSetString(INDICATOR_SHORTNAME, StringFormat("Laguerre Stoch Fast%s(%.2f, Sig %d)", type, InpGamma, InpSignalPeriod)); + IndicatorSetString(INDICATOR_SHORTNAME, StringFormat("Laguerre Stoch Fast%s(%.3f, Sig %d)", type, InpGamma, InpSignalPeriod)); //--- Visuals PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, 2); @@ -115,6 +115,16 @@ int OnCalculate(const int rates_total, if(rates_total < 2) return(0); + if(CheckPointer(g_calculator) == POINTER_INVALID) + return(0); + +//--- Force strict chronological indexing for state-safety on input price arrays + ArraySetAsSeries(time, false); + ArraySetAsSeries(open, false); + ArraySetAsSeries(high, false); + ArraySetAsSeries(low, false); + ArraySetAsSeries(close, false); + ENUM_APPLIED_PRICE price_type = (InpSourcePrice <= PRICE_HA_CLOSE) ? (ENUM_APPLIED_PRICE)(-(int)InpSourcePrice) : (ENUM_APPLIED_PRICE)InpSourcePrice; @@ -135,4 +145,3 @@ int OnCalculate(const int rates_total, return(rates_total); } //+------------------------------------------------------------------+ -//+------------------------------------------------------------------+