mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-08-26 02:38:05 +00:00
refactor: Added zero-copy inline price getter
This commit is contained in:
@@ -1,14 +1,17 @@
|
|||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
//| Laguerre_Engine.mqh |
|
//| Laguerre_Engine.mqh |
|
||||||
//| VERSION 1.20: Optimized for incremental calculation. |
|
//| VERSION 1.30: Added zero-copy inline price getter. |
|
||||||
//| Copyright 2025, xxxxxxxx |
|
//| Copyright 2026, xxxxxxxx |
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
#property copyright "Copyright 2025, xxxxxxxx"
|
#property copyright "Copyright 2026, xxxxxxxx"
|
||||||
|
#property version "1.30"
|
||||||
|
|
||||||
#include <MyIncludes\HeikinAshi_Tools.mqh>
|
#include <MyIncludes\HeikinAshi_Tools.mqh>
|
||||||
|
|
||||||
enum ENUM_INPUT_SOURCE { SOURCE_PRICE, SOURCE_MOMENTUM };
|
enum ENUM_INPUT_SOURCE { SOURCE_PRICE, SOURCE_MOMENTUM };
|
||||||
|
|
||||||
|
//+==================================================================+
|
||||||
|
//| CLASS: CLaguerreEngine |
|
||||||
//+==================================================================+
|
//+==================================================================+
|
||||||
class CLaguerreEngine
|
class CLaguerreEngine
|
||||||
{
|
{
|
||||||
@@ -35,14 +38,13 @@ public:
|
|||||||
|
|
||||||
void GetPriceBuffer(double &dest_array[]);
|
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[]);
|
void GetLBuffers(double &l0[], double &l1[], double &l2[], double &l3[]);
|
||||||
};
|
};
|
||||||
|
|
||||||
//+==================================================================+
|
|
||||||
//| METHOD IMPLEMENTATIONS |
|
|
||||||
//+==================================================================+
|
|
||||||
|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
//| Init |
|
//| Init |
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
@@ -111,7 +113,7 @@ void CLaguerreEngine::CalculateFilter(int rates_total, int prev_calculated, ENUM
|
|||||||
ArrayResize(m_L3, rates_total);
|
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)
|
if(ArraySize(filt_buffer) != rates_total)
|
||||||
ArrayResize(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;
|
return true;
|
||||||
}
|
}
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
|||||||
Reference in New Issue
Block a user