This commit is contained in:
2025-05-12 18:32:47 +03:30
parent a02bf1ba13
commit c927f50934
3 changed files with 258 additions and 46 deletions
@@ -1365,6 +1365,172 @@ class XCXCAEAPOIDetector : public XCBase
return result;
}
//
int FillPivots(
XBoxZone &pivots[],
XBoxZone &unavailables[],
ENUM_XCA_PIVOTS &allowedTypes[],
datetime to = NULL //
)
{
//
int result = 0;
//
Clean(pivots);
//
bool canUpdateTo = IsValid(to);
//
XBoxZone tmp[];
bool has = false;
int tmpCount = FillPivots(
tmp,
X_DIRECTION_ALL //
);
has = IsValidSize(tmpCount);
if (!has)
{
return result;
}
//
XBoxZone iBox;
while (HasChild(tmp))
{
//
iBox = tmp[0];
ArrayRemove(
tmp,
0,
1 //
);
//
if (canUpdateTo)
{
iBox.to = to;
}
//
ENUM_XCA_PIVOTS iType = GetPivotType(iBox);
bool isAllowed =
!HasChild(allowedTypes)
? true
: Contains(
iType,
allowedTypes //
);
//
int idx = -1;
bool isUnAvailable = FindBoxIndex(
idx,
iBox,
unavailables //
);
//
if (isAllowed &&
!isUnAvailable)
{
//
AddRef(
iBox,
pivots //
);
}
//
iBox.Clean();
}
iBox.Clean();
//
result = ArraySize(pivots);
//
return result;
}
//
int FillPivots(
XBoxZone &decision,
XBoxZone &pivots[],
XBoxZone &unavailables[],
ENUM_XCA_PIVOTS &allowedTypes[],
datetime to = NULL //
)
{
//
int result = false;
//
bool has = false;
has = decision.IsValid();
if (!has)
{
return result;
}
//
XBoxZone tmp[];
int count = FillPivots(
tmp,
pivots,
unavailables,
allowedTypes,
to //
);
//
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = tmp[i];
//
// Validate Box ...
has =
//
// Validate Time ..
iBox.from > box.from
//
&&
//
// Validate Price ...
(
//
(iBox.upper < box.upper &&
iBox.upper > box.lower)
//
||
//
(iBox.lower > box.lower &&
iBox.lower < box.upper)
//
);
if (has)
{
//
AddRef(
iBox,
pivots //
);
}
//
iBox.Clean();
}
//
Clean(tmp);
//
return result;
}
//
// Pivots ...