This commit is contained in:
2025-03-21 10:23:40 +03:30
parent 57bb590094
commit 7970785883
3 changed files with 364 additions and 244 deletions
@@ -2640,6 +2640,12 @@ struct X121SMCStrategyConditionParser
//
bool result = false;
//
// Configure ...
bool forceRetestBox = false;
bool forceHolderBox = false;
bool forceConsolidationZone = false;
//
// Fil Selected Data ...
XPOIState cState;
@@ -2755,6 +2761,7 @@ struct X121SMCStrategyConditionParser
IsBearish(iBarPosDir);
//
XBoxZone selectedBox;
XSignalBox iSignalBox;
count = ArraySize(waitingBoxes);
has = IsValidSize(count);
@@ -2807,18 +2814,41 @@ struct X121SMCStrategyConditionParser
//
has =
isBullish
? isBarValidForBullish &&
(hasFVG
? (hasFVG
? isFVGBullishRejected
: isOBBullishRejected)
: isBarValidForBearish &&
(hasFVG
: (hasFVG
? isFVGBearishRejected
: isOBBearishRejected);
//
// Force Using OB ...
if (!has && hasFVG)
{
//
has = isBullish
? isOBBullishRejected
: isOBBearishRejected;
//
selectedBox = iBox.ob;
}
if (has)
{
//
iSignalBox = iBox;
if (!selectedBox.IsValid())
{
//
if (hasFVG)
{
selectedBox = iBox.fvg;
}
else
{
selectedBox = iBox.ob;
}
}
iBox.Clean();
break;
}
@@ -2827,30 +2857,20 @@ struct X121SMCStrategyConditionParser
iBox.Clean();
}
}
has = iSignalBox.IsValid();
has =
iSignalBox.IsValid() &&
selectedBox.IsValid();
//
// Retest Signal ...
int retests = 0;
if (has)
{
//
bool hasFVG = iSignalBox.fvg.IsValid();
XBoxZone iBox;
if (hasFVG)
{
iBox = iSignalBox.fvg;
}
else
{
iBox = iSignalBox.ob;
}
//
int iFromIDX = GetBarIndex(
cBar.symbol,
cBar.period,
iBox.from //
selectedBox.from //
);
has = IsValidIndex(iFromIDX);
if (has)
@@ -2870,21 +2890,21 @@ struct X121SMCStrategyConditionParser
//
bool isBullishRetested =
//
iBar.low < iBox.upper &&
iBar.GetDown() > iBox.upper
iBar.low < selectedBox.upper &&
iBar.GetDown() > selectedBox.upper
//
;
//
bool isBearishRetested =
//
iBar.high > iBox.lower &&
iBar.GetUp() < iBox.lower
iBar.high > selectedBox.lower &&
iBar.GetUp() < selectedBox.lower
//
;
//
has = iBox.IsBullish()
has = selectedBox.IsBullish()
? isBullishRetested
: isBearishRetested;
if (has)
@@ -2896,18 +2916,23 @@ struct X121SMCStrategyConditionParser
iBar.Clean();
}
}
//
iBox.Clean();
}
//
bool isSignalBoxRetested = retests > 1;
bool isSignalBoxRetested =
!forceRetestBox
? retests >= 1
: retests >= 2;
bool hasSignalBox = iSignalBox.IsValid();
bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir);
//
// Check Consolidation Zone ...
bool hasBullishCZone = true;
bool hasBearishCZone = true;
if (forceConsolidationZone)
{
//
XBoxZone cZone;
XBoxZone tmpBoxes[];
if (isSignalBoxBullish)
@@ -2993,13 +3018,17 @@ struct X121SMCStrategyConditionParser
Clean(tmpBoxes);
//
bool hasBullishCZone = cZone.IsValid() &&
hasBullishCZone = cZone.IsValid() &&
cZone.IsBullish();
//
bool hasBearishZone = cZone.IsValid() &&
hasBearishCZone = cZone.IsValid() &&
cZone.IsBearish();
//
cZone.Clean();
}
//
// Bullish Conditions ...
isBullish =
@@ -3025,7 +3054,7 @@ struct X121SMCStrategyConditionParser
(
//
hasSignalBox &&
hasBearishZone &&
hasBearishCZone &&
!isSignalBoxBullish &&
isSignalBoxRetested &&
isBarValidForBearish
@@ -3048,20 +3077,14 @@ struct X121SMCStrategyConditionParser
: X_DIRECTION_BEARISH;
//
if (iSignalBox.fvg.IsValid())
{
box = iSignalBox.fvg;
}
else
{
box = iSignalBox.ob;
}
//
box = selectedBox;
box.to = TimeCurrent();
//
// Detect Holder Box ...
if (forceHolderBox)
{
//
XBoxZone tmpBoxes[];
if (isBullish)
{
@@ -3206,6 +3229,7 @@ struct X121SMCStrategyConditionParser
holderBox.Clean();
}
}
}
//
// Check All Conditions ...
@@ -3220,9 +3244,9 @@ struct X121SMCStrategyConditionParser
zBar.Clean();
cBar.Clean();
pBar.Clean();
cZone.Clean();
cState.Clean();
iSignalBox.Clean();
selectedBox.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cStateEvents.Clean();
@@ -228,8 +228,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
// Detectiong Signal Boxes ...
hasWaitingBoxes = workingZone
.DetectWaitingBoxes(
X_CYCLE_CONSOLIDATION,
X_CYCLE_ANALYSE,
X_CYCLE_DECISION,
provider,
zIndex //
);
@@ -662,11 +662,107 @@ struct X121SMCStrategyXWZWorkingZone
iSignalBox.ob = iOBBox;
iSignalBox.fvg = iFVGBox;
//
// Here We Check Waiting Box Contains Other Zones ...
// Like Support/Resistances ...
bool forceVerification = false;
if (forceVerification)
{
//
XBoxZone iVerificationBox;
XBoxZone tmpBoxes[];
if (isBullish)
{
//
ToBox(
provider.decisionState.supportZones,
tmpBoxes //
);
}
else
{
//
ToBox(
provider.decisionState.resistanceZones,
tmpBoxes //
);
}
has = HasChild(tmpBoxes);
if (has)
{
//
while (HasChild(tmpBoxes))
{
//
idx = GetYoungest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
break;
}
//
// Select Box ...
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
tmpBoxes,
idx,
1 //
);
//
// Validate Box ...
bool isValidPassed = !IsBoxValid(
iBox,
barIndex //
);
bool isDirPassed = iBox.dir == iOBBox.dir;
bool isPlacePassed =
IsBoxInside(
iBox,
iOBBox //
)
//
&&
//
(!iFVGBox.IsValid()
? true
: IsBoxInsideOr(
iBox,
iFVGBox //
));
//
has =
isDirPassed &&
isValidPassed &&
isPlacePassed;
if (has)
{
//
iVerificationBox = iBox;
iBox.Clean();
break;
}
//
iBox.Clean();
}
}
has = iVerificationBox.IsValid();
Clean(tmpBoxes);
iVerificationBox.Clean();
}
//
if (has)
{
//
AddRef(
iSignalBox,
waitingBoxes //
);
}
//
iSignalBox.Clean();