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
? isFVGBullishRejected
: isOBBullishRejected)
: isBarValidForBearish &&
(hasFVG
? isFVGBearishRejected
: isOBBearishRejected);
? (hasFVG
? isFVGBullishRejected
: isOBBullishRejected)
: (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,110 +2916,119 @@ 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 ...
XBoxZone cZone;
XBoxZone tmpBoxes[];
if (isSignalBoxBullish)
bool hasBullishCZone = true;
bool hasBearishCZone = true;
if (forceConsolidationZone)
{
//
ToBox(
cState.bullishConsolidationZones,
tmpBoxes //
);
}
else
{
//
ToBox(
cState.bearishConsolidationZones,
tmpBoxes //
);
}
has = HasChild(tmpBoxes);
if (has)
{
//
XBoxZone selectedBox;
if (iSignalBox.fvg.IsValid())
XBoxZone cZone;
XBoxZone tmpBoxes[];
if (isSignalBoxBullish)
{
selectedBox = iSignalBox.fvg;
//
ToBox(
cState.bullishConsolidationZones,
tmpBoxes //
);
}
else
{
selectedBox = iSignalBox.ob;
//
ToBox(
cState.bearishConsolidationZones,
tmpBoxes //
);
}
//
idx = GetYoungest(tmpBoxes);
has = IsValidIndex(idx);
has = HasChild(tmpBoxes);
if (has)
{
//
cZone = tmpBoxes[idx];
XBoxZone selectedBox;
if (iSignalBox.fvg.IsValid())
{
selectedBox = iSignalBox.fvg;
}
else
{
selectedBox = iSignalBox.ob;
}
//
// Check Consolidation Zone Place ...
has =
//
(
//
IsBoxInsideOr(
cZone,
selectedBox //
)
//
&&
//
cZone.from >= selectedBox.from
//
)
//
||
//
(
//
IsBoxInsideOr(
selectedBox,
cZone //
)
//
&&
//
selectedBox.from >= cZone.from
//
)
//
;
if (!has)
idx = GetYoungest(tmpBoxes);
has = IsValidIndex(idx);
if (has)
{
cZone.Clean();
//
cZone = tmpBoxes[idx];
//
// Check Consolidation Zone Place ...
has =
//
(
//
IsBoxInsideOr(
cZone,
selectedBox //
)
//
&&
//
cZone.from >= selectedBox.from
//
)
//
||
//
(
//
IsBoxInsideOr(
selectedBox,
cZone //
)
//
&&
//
selectedBox.from >= cZone.from
//
)
//
;
if (!has)
{
cZone.Clean();
}
}
//
selectedBox.Clean();
}
Clean(tmpBoxes);
//
selectedBox.Clean();
}
Clean(tmpBoxes);
hasBullishCZone = cZone.IsValid() &&
cZone.IsBullish();
//
bool 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,162 +3077,157 @@ struct X121SMCStrategyConditionParser
: X_DIRECTION_BEARISH;
//
if (iSignalBox.fvg.IsValid())
{
box = iSignalBox.fvg;
}
else
{
box = iSignalBox.ob;
}
//
box = selectedBox;
box.to = TimeCurrent();
//
// Detect Holder Box ...
XBoxZone tmpBoxes[];
if (isBullish)
if (forceHolderBox)
{
//
// Order Blocks ...
XBoxZone tmp[];
ToBox(
cState.bullishOrderBlocks,
tmp //
);
Copy(
tmp,
tmpBoxes //
);
Clean(tmp);
//
// Fair Value Gaps ...
ToBox(
cState.bullishFairValueGaps,
tmp //
);
Copy(
tmp,
tmpBoxes,
false // Ignore Clean ...
);
Clean(tmp);
//
// Support Zones ...
ToBox(
cState.supportZones,
tmp //
);
Copy(
tmp,
tmpBoxes,
false // Ignore Clean ...
);
Clean(tmp);
}
else
{
//
// Order Blocks ...
XBoxZone tmp[];
ToBox(
cState.bearishOrderBlocks,
tmp //
);
Copy(
tmp,
tmpBoxes //
);
Clean(tmp);
//
// Fair Value Gaps ...
ToBox(
cState.bearishFairValueGaps,
tmp //
);
Copy(
tmp,
tmpBoxes,
false // Ignore Clean ...
);
Clean(tmp);
//
// Resistance Zones ...
ToBox(
cState.resistanceZones,
tmp //
);
Copy(
tmp,
tmpBoxes,
false // Ignore Clean ...
);
Clean(tmp);
}
//
count = ArraySize(tmpBoxes);
has = IsValidSize(count);
if (has)
{
//
while (HasChild(tmpBoxes))
XBoxZone tmpBoxes[];
if (isBullish)
{
//
idx = GetOldest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
break;
}
// Order Blocks ...
XBoxZone tmp[];
ToBox(
cState.bullishOrderBlocks,
tmp //
);
Copy(
tmp,
tmpBoxes //
);
Clean(tmp);
//
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
// Fair Value Gaps ...
ToBox(
cState.bullishFairValueGaps,
tmp //
);
Copy(
tmp,
tmpBoxes,
idx,
1 //
false // Ignore Clean ...
);
Clean(tmp);
//
has = IsBoxInside(
iBox,
box //
// Support Zones ...
ToBox(
cState.supportZones,
tmp //
);
if (has)
Copy(
tmp,
tmpBoxes,
false // Ignore Clean ...
);
Clean(tmp);
}
else
{
//
// Order Blocks ...
XBoxZone tmp[];
ToBox(
cState.bearishOrderBlocks,
tmp //
);
Copy(
tmp,
tmpBoxes //
);
Clean(tmp);
//
// Fair Value Gaps ...
ToBox(
cState.bearishFairValueGaps,
tmp //
);
Copy(
tmp,
tmpBoxes,
false // Ignore Clean ...
);
Clean(tmp);
//
// Resistance Zones ...
ToBox(
cState.resistanceZones,
tmp //
);
Copy(
tmp,
tmpBoxes,
false // Ignore Clean ...
);
Clean(tmp);
}
//
count = ArraySize(tmpBoxes);
has = IsValidSize(count);
if (has)
{
//
while (HasChild(tmpBoxes))
{
//
holderBox = iBox;
holderBox.to = TimeCurrent();
idx = GetOldest(tmpBoxes);
has = IsValidIndex(idx);
if (!has)
{
break;
}
//
XBoxZone iBox = tmpBoxes[idx];
ArrayRemove(
tmpBoxes,
idx,
1 //
);
//
has = IsBoxInside(
iBox,
box //
);
if (has)
{
//
holderBox = iBox;
holderBox.to = TimeCurrent();
iBox.Clean();
break;
}
//
iBox.Clean();
break;
}
//
iBox.Clean();
}
}
//
Clean(tmpBoxes);
//
result =
result &&
holderBox.IsValid() &&
holderBox.dir == dir;
if (!result)
{
//
box.Clean();
isBullish = false;
isBearish = false;
holderBox.Clean();
Clean(tmpBoxes);
//
result =
result &&
holderBox.IsValid() &&
holderBox.dir == dir;
if (!result)
{
//
box.Clean();
isBullish = false;
isBearish = false;
holderBox.Clean();
}
}
}
@@ -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 //
);
+100 -4
View File
@@ -663,10 +663,106 @@ struct X121SMCStrategyXWZWorkingZone
iSignalBox.fvg = iFVGBox;
//
AddRef(
iSignalBox,
waitingBoxes //
);
// 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();