From bb8a27c3424ba77d7757fe8ca77a3c9ead118ca3 Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Sun, 21 Dec 2025 15:51:22 +0100 Subject: [PATCH] new files added --- .../Gaussian_Momentum_Advanced_Calculator.mqh | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 Include/MyIncludes/Gaussian_Momentum_Advanced_Calculator.mqh diff --git a/Include/MyIncludes/Gaussian_Momentum_Advanced_Calculator.mqh b/Include/MyIncludes/Gaussian_Momentum_Advanced_Calculator.mqh new file mode 100644 index 0000000..bb6ff35 --- /dev/null +++ b/Include/MyIncludes/Gaussian_Momentum_Advanced_Calculator.mqh @@ -0,0 +1,86 @@ +//+------------------------------------------------------------------+ +//| Gaussian_Momentum_Advanced_Calculator.mqh | +//| Advanced Engine: Gaussian Momentum + Signal Line. | +//| Copyright 2025, xxxxxxxx | +//+------------------------------------------------------------------+ +#property copyright "Copyright 2025, xxxxxxxx" + +#include +#include + +//+==================================================================+ +//| CLASS: CGaussianMomentumAdvancedCalculator | +//+==================================================================+ +class CGaussianMomentumAdvancedCalculator + { +protected: + //--- Composition + CGaussianFilterCalculator *m_mom_calc; + CMovingAverageCalculator m_sig_calc; + +public: + CGaussianMomentumAdvancedCalculator(void); + virtual ~CGaussianMomentumAdvancedCalculator(void); + + bool Init(int mom_period, int sig_period, ENUM_MA_TYPE sig_type, bool use_ha); + + void Calculate(int rates_total, int prev_calculated, ENUM_APPLIED_PRICE price_type, const double &open[], const double &high[], const double &low[], const double &close[], + double &mom_buffer[], double &sig_buffer[]); + }; + +//+------------------------------------------------------------------+ +//| Constructor | +//+------------------------------------------------------------------+ +CGaussianMomentumAdvancedCalculator::CGaussianMomentumAdvancedCalculator(void) : m_mom_calc(NULL) + { + } + +//+------------------------------------------------------------------+ +//| Destructor | +//+------------------------------------------------------------------+ +CGaussianMomentumAdvancedCalculator::~CGaussianMomentumAdvancedCalculator(void) + { + if(CheckPointer(m_mom_calc) != POINTER_INVALID) + delete m_mom_calc; + } + +//+------------------------------------------------------------------+ +//| Init | +//+------------------------------------------------------------------+ +bool CGaussianMomentumAdvancedCalculator::Init(int mom_period, int sig_period, ENUM_MA_TYPE sig_type, bool use_ha) + { +// Instantiate correct momentum calculator + if(use_ha) + m_mom_calc = new CGaussianFilterCalculator_HA(); + else + m_mom_calc = new CGaussianFilterCalculator(); + +// Init Momentum (SOURCE_MOMENTUM mode) + if(!m_mom_calc.Init(mom_period, SOURCE_MOMENTUM)) + return false; + +// Init Signal + if(!m_sig_calc.Init(sig_period, sig_type)) + return false; + + return true; + } + +//+------------------------------------------------------------------+ +//| Main Calculation | +//+------------------------------------------------------------------+ +void CGaussianMomentumAdvancedCalculator::Calculate(int rates_total, int prev_calculated, ENUM_APPLIED_PRICE price_type, const double &open[], const double &high[], const double &low[], const double &close[], + double &mom_buffer[], double &sig_buffer[]) + { + if(CheckPointer(m_mom_calc) == POINTER_INVALID) + return; + +// 1. Calculate Momentum + m_mom_calc.Calculate(rates_total, prev_calculated, price_type, open, high, low, close, mom_buffer); + +// 2. Calculate Signal Line +// Offset: 2 (Gaussian Filter warmup) + m_sig_calc.CalculateOnArray(rates_total, prev_calculated, mom_buffer, sig_buffer, 2); + } +//+------------------------------------------------------------------+ +//+------------------------------------------------------------------+