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:
@@ -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;
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user