This commit is contained in:
2025-03-06 03:09:33 +03:30
parent 32deb20560
commit 5160ea1c82
3 changed files with 169 additions and 15 deletions
+32 -3
View File
@@ -3855,6 +3855,9 @@ bool ToZoneBox(
return result; return result;
} }
//
bool isBullish = fvg.IsBullish();
// //
// Retrieve Main Fair Value Gap's Started Bar ... // Retrieve Main Fair Value Gap's Started Bar ...
XOHCL startedBar; XOHCL startedBar;
@@ -3893,11 +3896,37 @@ bool ToZoneBox(
return result; return result;
} }
//
// Validate Start Bar ...
result =
isBullish
? startedBar.high >= fvg.Upper() &&
startedBar.low < fvg.Upper()
: startedBar.low <= fvg.Lower() &&
startedBar.high > fvg.Lower();
if (!result)
{
//
box.Clean();
ZeroMemory(fvg);
startedBar.Clean();
//
return result;
}
// //
// Update Box using Started Bar ... // Update Box using Started Bar ...
box.lower = startedBar.low; box.lower = isBullish
box.upper = startedBar.high; ? box.lower
box.from = startedBar.NextAt(); : startedBar.low;
box.upper =
isBullish
? startedBar.high
: box.upper;
//
box.from = startedBar.time;
// //
// Check Box Validation ... // Check Box Validation ...
@@ -399,12 +399,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
// //
hasWaitingZones = workingZone.DetectZone( hasWaitingZones = workingZone.DetectZone(
drawer, drawer,
consolidationPoiEvents,
analysePoiEvents, analysePoiEvents,
decisionPoiEvents, consolidationPoiEvents,
analysePoiEvents, consolidationState,
analyseState, analyseState,
decisionState, consolidationState //
analyseState //
); );
// //
@@ -466,13 +466,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
// //
// Detect Signal Box ... // Detect Signal Box ...
hasSignalBox = hasWorkingZone && hasSignalBox =
hasWaitingZones && hasWorkingZone &&
workingZone.IsZoneOBRejected( hasWaitingZones &&
activatedZone, workingZone.IsZoneValidForSignal(
decisionXConditions, activatedZone,
zIndex // decisionXConditions,
); zIndex //
);
if (hasSignalBox) if (hasSignalBox)
{ {
// //
+125 -1
View File
@@ -729,6 +729,7 @@ struct X121SMCStrategyXWZWorkingZone
} }
// //
// TODO: Remove this ...
bool IsZoneOBRejected( bool IsZoneOBRejected(
XOBFVG &zone, XOBFVG &zone,
X121Conditions &conditions, X121Conditions &conditions,
@@ -797,7 +798,7 @@ struct X121SMCStrategyXWZWorkingZone
// //
result = delta == 0 || result = delta == 0 ||
delta < points * 2; delta < points * 2;
} }
// //
@@ -821,6 +822,129 @@ struct X121SMCStrategyXWZWorkingZone
return result; return result;
} }
//
bool IsZoneValidForSignal(
XOBFVG &zone,
X121Conditions &conditions,
int barIndex = 0 //
)
{
//
bool result = false;
//
// Cleanup Result ...
zone.Clean();
//
// Normalize Bar Index ...
if (barIndex < 0)
{
barIndex = 0;
}
//
if (barIndex == 0)
{
barIndex = 1;
}
//
// Validate ...
result = IsValid() &&
HasWaitingZones();
if (!result)
{
return result;
}
//
XOHCL bar;
result = bar.Init(
symbol,
period,
barIndex //
);
if (!result)
{
//
bar.Clean();
zone.Clean();
//
return result;
}
//
double peak = conditions.peaksBuffer[1];
double vale = conditions.valesBuffer[1];
//
int count = CountWaitingZones();
for (int i = 0; i < count; i++)
{
//
XOBFVG iOBFVG = waitingZones[i];
//
ENUM_X_DIRECTION iDir = iOBFVG.GetDirection();
bool isBullish = iOBFVG.IsBullish();
//
XBoxZone iBox;
result = iOBFVG.ToZone(iBox);
if (!result)
{
//
iBox.Clean();
iOBFVG.Clean();
//
continue;
}
//
// XCFVG *fvg;
// result = iOBFVG.GetMainFVG(fvg);
// if (!result)
// {
// //
// iOBFVG.Clean();
// ZeroMemory(fvg);
// //
// continue;
// }
//
result =
isBullish
? vale < iBox.upper &&
vale > iBox.lower
: peak < iBox.upper &&
peak > iBox.lower;
if (result)
{
//
zone = iOBFVG;
break;
}
//
iBox.Clean();
iOBFVG.Clean();
}
//
result = zone.IsValid();
//
bar.Clean();
//
return result;
}
// //
bool IsExists(XOBFVG &zone) bool IsExists(XOBFVG &zone)
{ {