This commit is contained in:
2025-06-09 21:51:45 +03:30
parent dc50f29932
commit 51d8c40c69
6 changed files with 5573 additions and 1878 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-126
View File
@@ -28,130 +28,4 @@
//
// Models ...
//
// Consolidation Zone ...
struct XConsolidationZone
{
//
// Props ...
//
string symbol; // Symbol ...
ENUM_TIMEFRAMES period; // Period ...
//
double upper; // Upper ...
double lower; // Lower ...
//
datetime from; // Start Date
datetime to; // Breake Date
//
ENUM_X_DIRECTION dir; // Break Direction ...
//
// Constructor ...
XConsolidationZone()
{
Clean();
}
//
// Tools ...
/**
* Cleanup ...
*/
void Clean()
{
//
upper = 0;
lower = 0;
//
to = NULL;
from = NULL;
symbol = NULL;
period = NULL;
dir = X_DIRECTION_NONE;
//
ZeroMemory(this);
}
/**
* Validate ...
*
* @return ( bool )
*/
bool IsValid()
{
//
bool result = false;
//
result =
//
upper > 0 &&
lower > 0 &&
IsValid(to) &&
IsValid(from) &&
IsValid(symbol) &&
IsValid(period) &&
HasDirection(dir)
//
;
//
return result;
}
bool IsSameAs(
XConsolidationZone &item //
)
{
//
bool result = false;
//
result = IsValid() &&
item.IsValid() &&
dir == item.dir &&
from == item.from &&
upper == item.upper &&
lower == item.lower &&
symbol == item.symbol &&
period == item.period;
//
return result;
}
/**
* Retrieve Unique Identifier ...
*
* @return ( string )
*/
string GetTag()
{
//
string result =
//
"XCZONE" + "_" +
ToString(dir) + "_" +
symbol + "_" +
ToString(period) + "_" +
ToString(upper) + "_" +
ToString(lower)
//
;
//
return result;
}
//
};
//
File diff suppressed because it is too large Load Diff
+29 -3
View File
@@ -309,11 +309,11 @@ struct XBoxZone
}
/**
* Extract Rejection Price based on Box Direction ...
*
* Retrieve Box Applied Price ...
*
* @return ( double )
*/
double GetRejection()
double GetDirectionalPrice()
{
//
double result = 0;
@@ -334,6 +334,32 @@ struct XBoxZone
return result;
}
/**
* Retrieve Box Breaked Price ...
*
* @return ( double )
*/
double GetInDirectionalPrice()
{
//
double result = 0;
//
if (!IsValid())
{
return result;
}
//
result =
IsBullish()
? lower
: upper;
//
return result;
}
/**
* To Bar Index ...
*
@@ -2458,7 +2458,7 @@ class XCXCATBEAPOIDetector : public XCBase
has = HasInvalidPivots();
if (has)
{
ApplySortOnBoxes(invalidPivots);
SortBoxes(invalidPivots);
}
//
@@ -2469,7 +2469,7 @@ class XCXCATBEAPOIDetector : public XCBase
has = HasPeakPivots();
if (has)
{
ApplySortOnBoxes(peakPivots);
SortBoxes(peakPivots);
}
//
@@ -2477,7 +2477,7 @@ class XCXCATBEAPOIDetector : public XCBase
has = HasValePivots();
if (has)
{
ApplySortOnBoxes(valePivots);
SortBoxes(valePivots);
}
//
@@ -2485,7 +2485,7 @@ class XCXCATBEAPOIDetector : public XCBase
has = HasMTBullishPivots();
if (has)
{
ApplySortOnBoxes(mtBullishPivots);
SortBoxes(mtBullishPivots);
}
//
@@ -2493,7 +2493,7 @@ class XCXCATBEAPOIDetector : public XCBase
has = HasMTBearishPivots();
if (has)
{
ApplySortOnBoxes(mtBearishPivots);
SortBoxes(mtBearishPivots);
}
//
@@ -2501,7 +2501,7 @@ class XCXCATBEAPOIDetector : public XCBase
has = HasOBBullishPivots();
if (has)
{
ApplySortOnBoxes(obBullishPivots);
SortBoxes(obBullishPivots);
}
//
@@ -2509,70 +2509,10 @@ class XCXCATBEAPOIDetector : public XCBase
has = HasOBBearishPivots();
if (has)
{
ApplySortOnBoxes(obBearishPivots);
SortBoxes(obBearishPivots);
}
}
//
void ApplySortOnBoxes(
XBoxZone &items[] //
)
{
//
int idx = -1;
bool has = false;
//
has = HasChild(items);
if (!has)
{
return;
}
//
XBoxZone tmp[];
Copy(
items,
tmp //
);
Clean(items);
//
while (HasChild(tmp))
{
//
idx = GetOldest(tmp);
has = IsValidIndex(idx);
if (!has)
{
break;
}
//
XBoxZone iBox = tmp[idx];
ArrayRemove(
tmp,
idx,
1 //
);
//
AddRef(
iBox,
items //
);
}
//
CleanupArray(
items,
maxAllowedPivots //
);
//
Clean(tmp);
}
//
void ApplyValidationOnBoxes(
XBoxZone &items[],