From b9d7c73ba17eaec3c004a6ceaa588eb6f3ad8a06 Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Wed, 1 Jul 2026 12:21:37 +0200 Subject: [PATCH] refactor: Upgraded with strict chronological sorting safeguards and pointer guards --- .../4_Channels_and_Bands/Ehlers_Channel_Pro.mq5 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Indicators/MyIndicators/Authors/Ehlers/4_Channels_and_Bands/Ehlers_Channel_Pro.mq5 b/Indicators/MyIndicators/Authors/Ehlers/4_Channels_and_Bands/Ehlers_Channel_Pro.mq5 index 4c14d2f..9dffed3 100644 --- a/Indicators/MyIndicators/Authors/Ehlers/4_Channels_and_Bands/Ehlers_Channel_Pro.mq5 +++ b/Indicators/MyIndicators/Authors/Ehlers/4_Channels_and_Bands/Ehlers_Channel_Pro.mq5 @@ -3,7 +3,7 @@ //| Copyright 2026, xxxxxxxx| //+------------------------------------------------------------------+ #property copyright "Copyright 2026, xxxxxxxx" -#property version "1.00" +#property version "1.10" // Upgraded with strict chronological sorting safeguards and pointer guards #property description "Ehlers Channel (Keltner Concept): Super/Ultimate Smoother Middle Line + ATR Bands." #property indicator_chart_window @@ -122,6 +122,16 @@ int OnCalculate(const int rates_total, if(rates_total < MathMax(InpPeriod, InpAtrPeriod)) 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;