refactor(indicators): Fixed Calculate parameters

This commit is contained in:
Toh4iem9
2026-01-02 13:53:29 +01:00
parent ea8dfb17d0
commit 8e4d88aec7
@@ -3,7 +3,7 @@
//| Copyright 2025, xxxxxxxx| //| Copyright 2025, xxxxxxxx|
//+------------------------------------------------------------------+ //+------------------------------------------------------------------+
#property copyright "Copyright 2025, xxxxxxxx" #property copyright "Copyright 2025, xxxxxxxx"
#property version "2.00" // Refactored to use MovingAverage_Engine #property version "3.10" // Fixed Calculate parameters
#property description "Slow Stochastic applied to the Chande Momentum Oscillator (CMO)." #property description "Slow Stochastic applied to the Chande Momentum Oscillator (CMO)."
#property indicator_separate_window #property indicator_separate_window
@@ -36,7 +36,6 @@ input int InpSlowingPeriod = 3;
input int InpDPeriod = 3; input int InpDPeriod = 3;
input group "MA & Price Settings" input group "MA & Price Settings"
input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD; input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD;
// UPDATED: Use ENUM_MA_TYPE
input ENUM_MA_TYPE InpSlowingMAType = SMA; input ENUM_MA_TYPE InpSlowingMAType = SMA;
input ENUM_MA_TYPE InpDMAType = SMA; input ENUM_MA_TYPE InpDMAType = SMA;
@@ -85,7 +84,10 @@ int OnCalculate(const int rates_total, const int prev_calculated, const datetime
return 0; return 0;
ENUM_APPLIED_PRICE price_type = (InpSourcePrice <= PRICE_HA_CLOSE) ? (ENUM_APPLIED_PRICE)(-(int)InpSourcePrice) : (ENUM_APPLIED_PRICE)InpSourcePrice; ENUM_APPLIED_PRICE price_type = (InpSourcePrice <= PRICE_HA_CLOSE) ? (ENUM_APPLIED_PRICE)(-(int)InpSourcePrice) : (ENUM_APPLIED_PRICE)InpSourcePrice;
g_calculator.Calculate(rates_total, prev_calculated, open, high, low, close, price_type, BufferK, BufferD); // FIX: Correct parameter order
// Calculate(rates_total, prev_calculated, price_type, open, high, low, close, ...)
g_calculator.Calculate(rates_total, prev_calculated, price_type, open, high, low, close, BufferK, BufferD);
return(rates_total); return(rates_total);
} }
//+------------------------------------------------------------------+ //+------------------------------------------------------------------+