diff --git a/Include/MyIncludes/Laguerre_Engine.mqh b/Include/MyIncludes/Laguerre_Engine.mqh index 37602c9..12f10c4 100644 --- a/Include/MyIncludes/Laguerre_Engine.mqh +++ b/Include/MyIncludes/Laguerre_Engine.mqh @@ -1,14 +1,17 @@ //+------------------------------------------------------------------+ //| Laguerre_Engine.mqh | -//| VERSION 1.20: Optimized for incremental calculation. | -//| Copyright 2025, xxxxxxxx | +//| VERSION 1.30: Added zero-copy inline price getter. | +//| Copyright 2026, xxxxxxxx | //+------------------------------------------------------------------+ -#property copyright "Copyright 2025, xxxxxxxx" +#property copyright "Copyright 2026, xxxxxxxx" +#property version "1.30" #include enum ENUM_INPUT_SOURCE { SOURCE_PRICE, SOURCE_MOMENTUM }; +//+==================================================================+ +//| CLASS: CLaguerreEngine | //+==================================================================+ class CLaguerreEngine { @@ -35,14 +38,13 @@ public: void GetPriceBuffer(double &dest_array[]); - //--- NEW: Accessors for internal state buffers (Needed for Laguerre RSI) + //--- NEW: Zero-copy inline price getter (Eliminates deep-copy performance bottleneck) + double GetPrice(int index) const { return m_price[index]; } + + //--- Accessors for internal state buffers (Needed for Laguerre RSI) void GetLBuffers(double &l0[], double &l1[], double &l2[], double &l3[]); }; -//+==================================================================+ -//| METHOD IMPLEMENTATIONS | -//+==================================================================+ - //+------------------------------------------------------------------+ //| Init | //+------------------------------------------------------------------+ @@ -111,7 +113,7 @@ void CLaguerreEngine::CalculateFilter(int rates_total, int prev_calculated, ENUM ArrayResize(m_L3, rates_total); } -// Resize output buffer if provided (might be dummy in RSI calc) +// Resize output buffer if provided if(ArraySize(filt_buffer) != rates_total) ArrayResize(filt_buffer, rates_total); @@ -262,3 +264,4 @@ bool CLaguerreEngine_HA::PreparePriceSeries(int rates_total, int start_index, EN return true; } //+------------------------------------------------------------------+ +//+------------------------------------------------------------------+