refactor all requirements for draw and detect pois and also add Fima Helper, Parser Class Implementations for Separation of Concerns ...

This commit is contained in:
2025-10-24 05:03:31 +03:30
parent d63c5596fc
commit 0b0cd70049
21 changed files with 25191 additions and 8447 deletions
+105 -18
View File
@@ -2452,6 +2452,64 @@ struct XPatternAnalysis
return result;
}
/**
* Extract All Exists Patterns Pivots ...
*
* @param dest: XPivot, collection reference to holds Extracted Patterns ...
* @param forDir: ENUM_X_DIRECTION, Specified Direction of Extractions ...
*
* @return ( int )
*/
int GetPatterns(
XPivot &dest[],
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = 0;
//
// Prepare ...
XClean(dest);
//
// Validate ...
bool has = IsValid() &&
HasChild(patterns);
if (!has)
{
return result;
}
//
// Do ...
XOHCL iBar;
XPivot iPivot;
XBoxZone iZone;
int count = ArraySize(patterns);
for (int i = 0; i < count; i++)
{
//
has = GetPattern(iBar, iPivot, iZone, patterns[i], forDir);
if (has)
{
AddIfNotExists(iPivot, dest);
}
}
//
result = ArraySize(dest);
//
// Cleanup ...
iBar.Clean();
iZone.Clean();
iPivot.Clean();
//
return result;
}
//
};
@@ -2460,12 +2518,6 @@ struct XPatternAnalysisConfig
//
// Props ...
//
// Quarter ...
int quarterZonesRequiredToStart;
int quarterZoneDetectionLoopback;
int quarterZonesValidationLength;
//
// PV ...
int pvValidationLength;
@@ -2523,12 +2575,6 @@ struct XPatternAnalysisConfig
*/
void Clean()
{
//
// Quarter ...
quarterZonesRequiredToStart = 0;
quarterZoneDetectionLoopback = 0;
quarterZonesValidationLength = 0;
//
// PV ...
pvValidationLength = 0;
@@ -2580,12 +2626,6 @@ struct XPatternAnalysisConfig
*/
void Default()
{
//
// Quarter ...
quarterZonesRequiredToStart = 20;
quarterZonesValidationLength = 3;
quarterZoneDetectionLoopback = 1500;
//
// PV ...
pvValidationLength = 5;
@@ -3073,4 +3113,51 @@ struct XPatternAnalysisDrawConfig
}
};
//
// Extensions ...
bool FindByTime(
int &index,
datetime time,
XPatternAnalysis &source[] //
)
{
//
bool result = false;
//
// Prepare ...
index = -1;
//
// Validate ...
result = IsXValid(time) &&
HasChild(source);
if (!result)
{
return result;
}
//
// Do ...
int count = ArraySize(source);
for (int i = 0; i < count; i++)
{
//
result = source[i].bar.time == time;
if (result)
{
//
index = i;
break;
}
}
//
result = IsValidIndex(index);
//
return result;
}
//
@@ -2271,6 +2271,7 @@ void SortBar(
//+------------------------------------------------------------------+
//| Extraction |
//+------------------------------------------------------------------+
/**
* Extract Specific Types of Pivots From a Collection ...
*
@@ -2329,6 +2330,61 @@ int ExtractPivots(
return result;
}
/**
* Extract Same Time Pivots ...
*
* @param item: XPivot, reference to Specified Pivot for Detect Same Times ...
* @param dest: XPivot, collection reference to holds Same Times Pivots ...
* @param source: XPivot, collection reference to Provide Data Source ...
*
* @return ( int )
*/
int ExtractSameTimePivots(
XPivot &item,
XPivot &dest[],
XPivot &source[] //
)
{
//
int result = 0;
//
// Prepare ...
XClean(dest);
//
// Validate ...
bool has = HasChild(source) &&
item.IsValid();
if (!has)
{
return result;
}
//
// Do ...
int count = ArraySize(source);
for (int i = 0; i < count; i++)
{
//
has = item.time == source[i].time;
if (has)
{
AddIfNotExists(source[i], dest);
}
}
//
// Add item as a Child ...
AddIfNotExists(item, dest);
//
result = ArraySize(dest);
//
return result;
}
/**
* Extract Pivots Data for Linear Regression Calculations ...
*
+11 -2
View File
@@ -333,9 +333,9 @@ enum ENUM_X_DETECTOR_ZONE_ACTION
/**
* Validate an ENUM member ...
*
*
* @param value: ENUM_X_DETECTOR_ZONE_ACTION ...
*
*
* @return ( bool )
*/
bool IsXValid(ENUM_X_DETECTOR_ZONE_ACTION value)
@@ -636,6 +636,15 @@ struct XPivot
symbol == item.symbol &&
period == item.period;
//
if (result && IsXValid(prefix))
{
//
result =
result &&
prefix == item.prefix;
}
//
return result;
}