mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-08-26 02:38:05 +00:00
refactor: Optimized for array index safety and robust pointer verification
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
//| Copyright 2026, xxxxxxxx|
|
//| Copyright 2026, xxxxxxxx|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
#property copyright "Copyright 2026, xxxxxxxx"
|
#property copyright "Copyright 2026, xxxxxxxx"
|
||||||
#property version "3.00" // Updated with flexible Signal Line
|
#property version "3.05" // Optimized for array index safety and robust pointer verification
|
||||||
#property description "John Ehlers' Cyber Cycle indicator for identifying market cycles."
|
#property description "John Ehlers' Cyber Cycle indicator for identifying market cycles."
|
||||||
#property description "Features O(1) calculation and flexible Signal Line options."
|
#property description "Features O(1) calculation and flexible Signal Line options."
|
||||||
|
|
||||||
@@ -108,6 +108,16 @@ int OnCalculate(const int rates_total,
|
|||||||
if(rates_total < 7)
|
if(rates_total < 7)
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
|
if(CheckPointer(g_calculator) == POINTER_INVALID)
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
//--- Force strict chronological indexing for state-safety on input price arrays
|
||||||
|
ArraySetAsSeries(time, false);
|
||||||
|
ArraySetAsSeries(open, false);
|
||||||
|
ArraySetAsSeries(high, false);
|
||||||
|
ArraySetAsSeries(low, false);
|
||||||
|
ArraySetAsSeries(close, false);
|
||||||
|
|
||||||
ENUM_APPLIED_PRICE price_type = (InpSourcePrice <= PRICE_HA_CLOSE) ?
|
ENUM_APPLIED_PRICE price_type = (InpSourcePrice <= PRICE_HA_CLOSE) ?
|
||||||
(ENUM_APPLIED_PRICE)(-(int)InpSourcePrice) :
|
(ENUM_APPLIED_PRICE)(-(int)InpSourcePrice) :
|
||||||
(ENUM_APPLIED_PRICE)InpSourcePrice;
|
(ENUM_APPLIED_PRICE)InpSourcePrice;
|
||||||
|
|||||||
Reference in New Issue
Block a user