mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-08-26 02:38:05 +00:00
refactor: Optimized for incremental calculation
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
#property indicator_type1 DRAW_LINE
|
#property indicator_type1 DRAW_LINE
|
||||||
#property indicator_color1 clrBlueViolet
|
#property indicator_color1 clrBlueViolet
|
||||||
#property indicator_style1 STYLE_SOLID
|
#property indicator_style1 STYLE_SOLID
|
||||||
#property indicator_width1 1
|
#property indicator_width1 2
|
||||||
|
|
||||||
#include <MyIncludes\Ehlers_Smoother_Calculator.mqh>
|
#include <MyIncludes\Ehlers_Smoother_Calculator.mqh>
|
||||||
|
|
||||||
@@ -66,11 +66,9 @@ void OnDeinit(const int reason)
|
|||||||
delete g_calculator;
|
delete g_calculator;
|
||||||
}
|
}
|
||||||
|
|
||||||
//+------------------------------------------------------------------+
|
|
||||||
//| Custom indicator calculation function |
|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
int OnCalculate(const int rates_total,
|
int OnCalculate(const int rates_total,
|
||||||
const int prev_calculated, // <--- Now used!
|
const int prev_calculated,
|
||||||
const datetime &time[],
|
const datetime &time[],
|
||||||
const double &open[],
|
const double &open[],
|
||||||
const double &high[],
|
const double &high[],
|
||||||
@@ -89,7 +87,6 @@ int OnCalculate(const int rates_total,
|
|||||||
else
|
else
|
||||||
price_type = (ENUM_APPLIED_PRICE)InpSourcePrice;
|
price_type = (ENUM_APPLIED_PRICE)InpSourcePrice;
|
||||||
|
|
||||||
//--- Delegate calculation with prev_calculated optimization
|
|
||||||
g_calculator.Calculate(rates_total, prev_calculated, price_type, open, high, low, close, BufferFilter);
|
g_calculator.Calculate(rates_total, prev_calculated, price_type, open, high, low, close, BufferFilter);
|
||||||
|
|
||||||
return(rates_total);
|
return(rates_total);
|
||||||
|
|||||||
Reference in New Issue
Block a user