This commit is contained in:
2025-04-27 02:16:59 +03:30
parent a34ca8272a
commit 86846de1d1
4 changed files with 1795 additions and 614 deletions
+126
View File
@@ -26,6 +26,7 @@
#include "../../Libraries/x-saherelm.x-poi.lib.mq5"
#include "../../Libraries/x-saherelm.x-trade.lib.mq5"
#include "../Classes/xcaea.x-poi.detector.class.mq5"
#include "../Classes/xcaea.x-poi.drawer.class.mq5"
#include "../Helpers/xcaea.helper.mq5"
//
@@ -421,6 +422,7 @@ int AddGuard(
//
bool DetectXCAEAConditions(
XCXCAEAPOIDrawer *drawer,
ENUM_X_DIRECTION trend,
XBoxZone &pivots[],
XCAEAConditions &conditions,
@@ -761,6 +763,23 @@ bool DetectXCAEAConditions(
//
// Parsing Pivots ...
//
// Select Inside Boxes ...
XBoxZone insidePivots[];
int insidePivotsCount = SelectInsideBoxes(
insidePivots,
pivots,
zBar,
cBar,
pBar,
p2Bar //
);
bool hasInsidePivots = IsValidSize(insidePivotsCount);
if (hasInsidePivots) {
//
drawer.DrawBoxes(insidePivots, TimeCurrent());
}
//
// Detect Selected Pivot ...
XBoxZone rejectedPivot;
@@ -986,6 +1005,113 @@ bool DetectXCAEAConditions(
return result;
}
//
// Select Inside Boxes ...
int SelectInsideBoxes(
XBoxZone &insideBoxes[],
XBoxZone &boxes[],
XOHCL &zBar,
XOHCL &cBar,
XOHCL &pBar,
XOHCL &p2Bar //
)
{
//
int result = 0;
//
Clean(insideBoxes);
//
bool has =
zBar.IsValid() &&
cBar.IsValid() &&
pBar.IsValid() &&
p2Bar.IsValid() &&
HasChild(boxes);
if (!has)
{
return result;
}
//
int count = ArraySize(boxes);
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = boxes[i];
//
// Check Box Type ...
bool isTypePassed =
//
iBox.type == GetBoxType(XCA_TREND_BULL) ||
iBox.type == GetBoxType(XCA_TREND_BEAR)
//
;
if (!isTypePassed)
{
//
iBox.Clean();
//
continue;
}
//
bool isBullish = iBox.IsBullish();
bool isBearish = iBox.IsBearish();
//
// Check Inside Conditions ...
//
bool isBullishInside =
//
isBullish &&
//
((cBar.low < iBox.upper &&
cBar.low > iBox.lower) ||
(cBar.GetDown() < iBox.upper &&
cBar.GetDown() > iBox.lower))
//
;
//
bool isBearishInside =
//
isBearish &&
//
((cBar.high > iBox.lower &&
cBar.high < iBox.upper) ||
(cBar.GetUp() > iBox.lower &&
cBar.GetUp() < iBox.upper))
//
;
//
has = isBullishInside ||
isBearishInside;
if (has)
{
//
AddRef(
iBox,
insideBoxes //
);
}
//
iBox.Clean();
}
//
result = ArraySize(insideBoxes);
//
return result;
}
//
bool SelectRejectedBox(
XBoxZone &box,