mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-08-25 18:28:04 +00:00
refactor: Advanced Settings
This commit is contained in:
@@ -4,8 +4,9 @@
|
|||||||
//| |
|
//| |
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
#property copyright "Copyright 2025, xxxxxxxx"
|
#property copyright "Copyright 2025, xxxxxxxx"
|
||||||
#property version "1.00"
|
#property version "2.00" // Added Ehlers' optimized gain (Error Correcting) mode
|
||||||
#property description "Zero-Lag Exponential Moving Average (ZLEMA) based on John Ehlers' concept."
|
#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_chart_window
|
||||||
#property indicator_buffers 1
|
#property indicator_buffers 1
|
||||||
@@ -21,6 +22,9 @@
|
|||||||
//--- Input Parameters ---
|
//--- Input Parameters ---
|
||||||
input int InpPeriod = 20; // EMA Period
|
input int InpPeriod = 20; // EMA Period
|
||||||
input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD;
|
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 ---
|
//--- Indicator Buffers ---
|
||||||
double BufferZLEMA[];
|
double BufferZLEMA[];
|
||||||
@@ -45,7 +49,7 @@ int OnInit()
|
|||||||
IndicatorSetString(INDICATOR_SHORTNAME, StringFormat("ZLEMA(%d)", InpPeriod));
|
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.");
|
Print("Failed to initialize Zero-Lag EMA Calculator.");
|
||||||
return(INIT_FAILED);
|
return(INIT_FAILED);
|
||||||
|
|||||||
Reference in New Issue
Block a user