mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-07-27 20:47:44 +00:00
refactor: Optimized for incremental calculation
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| FisherTransform_Pro.mq5|
|
||||
//| Copyright 2025, xxxxxxxx|
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2025, xxxxxxxx"
|
||||
#property link ""
|
||||
#property version "3.01" // Corrected calculator call signature
|
||||
#property version "3.10" // Optimized for incremental calculation
|
||||
#property description "Professional Fisher Transform Oscillator with selectable"
|
||||
#property description "candle source (Standard or Heikin Ashi)."
|
||||
|
||||
@@ -107,10 +105,10 @@ void OnDeinit(const int reason)
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Custom indicator calculation function. |
|
||||
//| Custom indicator calculation function |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnCalculate(const int rates_total,
|
||||
const int prev_calculated,
|
||||
const int prev_calculated, // <--- Now used!
|
||||
const datetime &time[],
|
||||
const double &open[],
|
||||
const double &high[],
|
||||
@@ -120,15 +118,13 @@ int OnCalculate(const int rates_total,
|
||||
const long &volume[],
|
||||
const int &spread[])
|
||||
{
|
||||
//--- Ensure the calculator object is valid
|
||||
if(CheckPointer(g_calculator) == POINTER_INVALID)
|
||||
return 0;
|
||||
|
||||
//--- Delegate the entire calculation to our calculator object
|
||||
//--- CORRECTED: Pass all OHLC arrays for HA calculation
|
||||
g_calculator.Calculate(rates_total, open, high, low, close, BufferFisher, BufferTrigger);
|
||||
//--- Delegate calculation with prev_calculated optimization
|
||||
// Note: price_type is not used by Fisher (it always uses HL2), but we pass OHLC arrays.
|
||||
g_calculator.Calculate(rates_total, prev_calculated, open, high, low, close, BufferFisher, BufferTrigger);
|
||||
|
||||
//--- Return rates_total for a full recalculation, ensuring stability
|
||||
return(rates_total);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
|
||||
Reference in New Issue
Block a user