last works on major/minor Support and Resistances in Pattern Detector Class ...

This commit is contained in:
2025-10-13 16:20:55 +03:30
parent 85db6eeca1
commit abd074dffb
4 changed files with 1281 additions and 53 deletions
+261 -2
View File
@@ -74,6 +74,56 @@ int GetOldest(
return result;
}
/**
* Get Oldest Index of Specified Collection ...
*
* @param source: Specified Collection ...
* @param forDir: ENUM_X_DIRECTION, Specified Direction ...
*
* @return ( int )
*/
int GetOldestByDir(
XBoxZone &source[],
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = -1;
//
int count = ArraySize(source);
if (!IsValidSize(count))
{
return result;
}
//
XBoxZone selected;
for (int i = 0; i < count; i++)
{
//
bool canSet =
(!HasDirection(forDir)
? true
: forDir == source[i].dir) &&
(!selected.IsValid()
? true
: selected.from > source[i].from);
if (canSet)
{
//
result = i;
selected = source[i];
}
}
//
selected.Clean();
//
return result;
}
/**
* Get Oldest Index of Specified Collection ...
*
@@ -253,6 +303,56 @@ int GetYoungest(
return result;
}
/**
* Get Youngest Index of Specified Collection ...
*
* @param source: Specified Collection ...
* @param forDir: ENUM_X_DIRECTION, Specified Direction ...
*
* @return ( int )
*/
int GetYoungestByDir(
XBoxZone &source[],
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = -1;
//
int count = ArraySize(source);
if (!IsValidSize(count))
{
return result;
}
//
XBoxZone selected;
for (int i = 0; i < count; i++)
{
//
bool canSet =
(!HasDirection(forDir)
? true
: forDir == source[i].dir) &&
(!selected.IsValid()
? true
: selected.from < source[i].from);
if (canSet)
{
//
result = i;
selected = source[i];
}
}
//
selected.Clean();
//
return result;
}
/**
* Get Youngest Index of Specified Collection ...
*
@@ -432,6 +532,56 @@ int GetHighest(
return result;
}
/**
* Get Highest Index of Specified Collection ...
*
* @param source: Specified Collection ...
* @param forDir: ENUM_X_DIRECTION, Specified Direction ...
*
* @return ( int )
*/
int GetHighestByDir(
XBoxZone &source[],
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = -1;
//
int count = ArraySize(source);
if (!IsValidSize(count))
{
return result;
}
//
XBoxZone selected;
for (int i = 0; i < count; i++)
{
//
bool canSet =
(!HasDirection(forDir)
? true
: forDir == source[i].dir) &&
(!selected.IsValid()
? true
: selected.upper < source[i].upper);
if (canSet)
{
//
result = i;
selected = source[i];
}
}
//
selected.Clean();
//
return result;
}
/**
* Get Highest Index of Specified Collection ...
*
@@ -627,6 +777,62 @@ int GetLowest(
return result;
}
/**
* Get Lowest Index of Specified Collection ...
*
* @param source: Specified Collection ...
* @param forDir: ENUM_X_DIRECTION, Specified Direction ...
*
* @return ( int )
*/
int GetLowestByDir(
XBoxZone &source[],
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
)
{
//
int result = -1;
//
int count = ArraySize(source);
if (!IsValidSize(count))
{
return result;
}
//
XBoxZone selected;
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = source[i];
//
bool canSet =
(!HasDirection(forDir)
? true
: forDir == source[i].dir) &&
(!selected.IsValid()
? true
: selected.lower > iBox.lower);
if (canSet)
{
//
result = i;
selected = iBox;
}
//
iBox.Clean();
}
//
selected.Clean();
//
return result;
}
/**
* Get Lowest Index of Specified Collection ...
*
@@ -4566,6 +4772,59 @@ bool ToResistanceBox(
return result;
}
/**
* Remove Breaked Zones from a Collection ...
*
* @param source: XBoxZone, reference to Specified Collection ...
*
* @return ( int )
*/
int RemoveBreakedZones(XBoxZone &source[])
{
//
int result = 0;
//
// Validate ...
bool has = HasChild(source);
if (!has)
{
return result;
}
//
XBoxZone iZone;
XBoxZone tmps[];
Copy(
source,
tmps //
);
XClean(source);
while (HasChild(tmps))
{
//
iZone.Clean();
iZone = tmps[0];
ArrayRemove(tmps, 0, 1);
has = iZone.IsValid() &&
!IsXValid(iZone.breakAt);
if (has)
{
//
AddIfNotExists(
iZone,
source //
);
}
}
//
result = ArraySize(source);
//
return result;
}
/**
* Check Specified Zone is Breaked by Specified Bar or not ...
*
@@ -4957,12 +5216,12 @@ bool HasInside(
/**
* Extract Affected Zones for Specified Bar ...
*
*
* @param bar: XOHCL, reference to Specified Bar ...
* @param source: XBoxZone, reference collection to Provide Data Source ...
* @param dest: XBoxZone, reference collection to holds result ...
* @param forDir: ENUM_X_DIRECTION, Specified Zones Direction to Lookup ...
*
*
* @return ( int )
*/
int ExtractAffectedZones(