From 2e69015748fcc909f70ffe57962cf8311973a62d Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Thu, 23 Oct 2025 17:59:33 +0200 Subject: [PATCH] refactor: Advanced Settings --- Indicators/MyIndicators/ZeroLag_EMA_Pro.mq5 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Indicators/MyIndicators/ZeroLag_EMA_Pro.mq5 b/Indicators/MyIndicators/ZeroLag_EMA_Pro.mq5 index 15523e5..a77f10c 100644 --- a/Indicators/MyIndicators/ZeroLag_EMA_Pro.mq5 +++ b/Indicators/MyIndicators/ZeroLag_EMA_Pro.mq5 @@ -4,8 +4,9 @@ //| | //+------------------------------------------------------------------+ #property copyright "Copyright 2025, xxxxxxxx" -#property version "1.00" -#property description "Zero-Lag Exponential Moving Average (ZLEMA) based on John Ehlers' concept." +#property version "2.00" // Added Ehlers' optimized gain (Error Correcting) mode +#property description "Zero-Lag Exponential Moving Average (ZLEMA). Supports standard" +#property description "and Ehlers' optimized gain (Error Correcting) modes." #property indicator_chart_window #property indicator_buffers 1 @@ -21,6 +22,9 @@ //--- Input Parameters --- input int InpPeriod = 20; // EMA Period input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD; +input group "Advanced Settings" +input bool InpOptimizeGain = false; // Use Ehlers' Error Correcting (slower) +input double InpGainLimit = 5.0; // Gain Limit for optimization (e.g., 5.0 = +/- 50 steps) //--- Indicator Buffers --- double BufferZLEMA[]; @@ -45,7 +49,7 @@ int OnInit() IndicatorSetString(INDICATOR_SHORTNAME, StringFormat("ZLEMA(%d)", InpPeriod)); } - if(CheckPointer(g_calculator) == POINTER_INVALID || !g_calculator.Init(InpPeriod)) + if(CheckPointer(g_calculator) == POINTER_INVALID || !g_calculator.Init(InpPeriod, InpOptimizeGain, InpGainLimit)) { Print("Failed to initialize Zero-Lag EMA Calculator."); return(INIT_FAILED);