refactor: SOURCE_MOMENTUM

This commit is contained in:
Toh4iem9
2025-10-28 15:33:59 +01:00
parent eb482249ad
commit b1920d84e5
@@ -7,10 +7,6 @@
#include "Laguerre_Engine.mqh"
//+==================================================================+
//| |
//| CLASS 1: CLaguerreFilterCalculator (Base Class) |
//| |
//+==================================================================+
class CLaguerreFilterCalculator
{
@@ -21,15 +17,17 @@ public:
CLaguerreFilterCalculator(void) { m_engine = new CLaguerreEngine(); };
virtual ~CLaguerreFilterCalculator(void) { if(CheckPointer(m_engine) != POINTER_INVALID) delete m_engine; };
bool Init(double gamma);
bool Init(double gamma, ENUM_INPUT_SOURCE source_type);
void Calculate(int rates_total, ENUM_APPLIED_PRICE price_type, const double &open[], const double &high[], const double &low[], const double &close[],
double &filter_buffer[], double &fir_buffer[]);
};
bool CLaguerreFilterCalculator::Init(double gamma) { return m_engine.Init(gamma); }
//+------------------------------------------------------------------+
//| |
bool CLaguerreFilterCalculator::Init(double gamma, ENUM_INPUT_SOURCE source_type)
{
return m_engine.Init(gamma, source_type);
}
//+------------------------------------------------------------------+
void CLaguerreFilterCalculator::Calculate(int rates_total, ENUM_APPLIED_PRICE price_type, const double &open[], const double &high[], const double &low[], const double &close[],
double &filter_buffer[], double &fir_buffer[])
@@ -37,14 +35,12 @@ void CLaguerreFilterCalculator::Calculate(int rates_total, ENUM_APPLIED_PRICE pr
double L0[], L1[], L2[], L3[], filt[];
m_engine.CalculateFilter(rates_total, price_type, open, high, low, close, L0, L1, L2, L3, filt);
// Copy the final, weighted Laguerre filter result to the output buffer
ArrayCopy(filter_buffer, filt, 0, 0, rates_total);
// --- CORRECTED: Calculate the comparative FIR filter using the public getter ---
if(rates_total > 3)
{
double price_data[];
m_engine.GetPriceBuffer(price_data); // Safely get the price data from the engine
m_engine.GetPriceBuffer(price_data);
for(int i = 3; i < rates_total; i++)
{
@@ -53,10 +49,6 @@ void CLaguerreFilterCalculator::Calculate(int rates_total, ENUM_APPLIED_PRICE pr
}
}
//+==================================================================+
//| |
//| CLASS 2: CLaguerreFilterCalculator_HA (Heikin Ashi) |
//| |
//+==================================================================+
class CLaguerreFilterCalculator_HA : public CLaguerreFilterCalculator
{