apply XWZ Signals in Quarters ...

required to apply R2R and Targets ...
required to Apply Max Allowed TP ...
required to Apply Guards ...
required to Apply Tragets ...
This commit is contained in:
2025-02-16 05:34:57 +03:30
parent 62bfa7760c
commit 11fca38b6a
2 changed files with 151 additions and 64 deletions
@@ -84,10 +84,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
;
if (!result)
{
//
RemoveDraws();
RemoveWorkingZoneDraws();
//
mConditions.Clean();
@@ -142,10 +138,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
);
if (!result)
{
//
RemoveDraws();
RemoveWorkingZoneDraws();
//
mConditions.Clean();
@@ -167,10 +159,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
);
if (!result)
{
//
RemoveDraws();
RemoveWorkingZoneDraws();
//
mConditions.Clean();
@@ -192,10 +180,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
);
if (!result)
{
//
RemoveDraws();
RemoveWorkingZoneDraws();
//
mConditions.Clean();
@@ -217,10 +201,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
);
if (!result)
{
//
RemoveDraws();
RemoveWorkingZoneDraws();
//
mConditions.Clean();
@@ -287,10 +267,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
consolidationConditions.Clean();
consolidationXConditions.Clean();
//
RemoveDraws();
RemoveWorkingZoneDraws();
//
mConditions.Clean();
@@ -330,10 +306,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
consolidationConditions.Clean();
consolidationXConditions.Clean();
//
RemoveDraws();
RemoveWorkingZoneDraws();
//
mConditions.Clean();
@@ -373,10 +345,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
consolidationConditions.Clean();
consolidationXConditions.Clean();
//
RemoveDraws();
RemoveWorkingZoneDraws();
//
mConditions.Clean();
@@ -449,14 +417,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
mConditions.UpdateTo(cTime);
//
// TODO: Remove ...
RemoveWorkingZoneDraws();
DrawWorkingZone(
mConditions,
visionCycleHelper.mPOIDrawer //
);
//
// Check Working Zone still Alive ...
ENUM_X_DIRECTION destroyedDir = X_DIRECTION_NONE;
@@ -623,14 +583,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
mConditions.UpdateTo(cTime);
//
// TODO: Remove This ...
RemoveDraws();
DrawConditions(
mConditions,
visionCycleHelper.mPOIDrawer //
);
//
// Detect Start Zone Conditions ...
bool hasCondition = mConditions
@@ -644,8 +596,30 @@ class XCX121SMCXWZSignalDetector : public XCBase
.startZone
.GetDirection();
//
// Detect Condition Priority ...
ENUM_X121SMC_XWZ_PRIORITY bullishPriority;
ENUM_X121SMC_XWZ_PRIORITY bearishPriority;
mConditions.DetectPriority(
bullishPriority,
bearishPriority //
);
//
bool canLookupLong = bullishPriority != X121SMC_XWZ_PRIORITY_NONE &&
bullishPriority != X121SMC_XWZ_PRIORITY_WEAK;
bool canLookupShort = bearishPriority != X121SMC_XWZ_PRIORITY_NONE &&
bearishPriority != X121SMC_XWZ_PRIORITY_WEAK;
bool isPriorityPassed =
hasBullishTrend
? canLookupLong
: hasBearishTrend
? canLookupShort
: false;
//
result = hasCondition &&
isPriorityPassed &&
trend == conditionsDir;
if (!result)
{
@@ -676,10 +650,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
consolidationConditions.Clean();
consolidationXConditions.Clean();
//
RemoveDraws();
RemoveWorkingZoneDraws();
//
mConditions.Clean();
@@ -700,14 +670,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
mConditions.UpdateTo(cTime);
//
// TODO: Remove This ...
RemoveDraws();
DrawConditions(
mConditions,
visionCycleHelper.mPOIDrawer //
);
//
Clean(visionPoiEvents);
Clean(analysePoiEvents);
@@ -735,10 +697,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
consolidationConditions.Clean();
consolidationXConditions.Clean();
//
// RemoveDraws();
// RemoveWorkingZoneDraws();
//
return result;
}
@@ -34,6 +34,7 @@ enum ENUM_X121SMC_XWZ_PRIORITY
X121SMC_XWZ_PRIORITY_LOW,
X121SMC_XWZ_PRIORITY_REGULAR,
X121SMC_XWZ_PRIORITY_HIGH,
X121SMC_XWZ_PRIORITY_STRONG_HIGH,
};
//
@@ -2879,6 +2880,134 @@ struct X121SMCStrategyXWZSignalConditions
return result;
}
//
void DetectPriority(
ENUM_X121SMC_XWZ_PRIORITY &bullish,
ENUM_X121SMC_XWZ_PRIORITY &bearish,
int barIndex = 0,
ENUM_TIMEFRAMES forPeriod = NULL //
)
{
//
bullish = X121SMC_XWZ_PRIORITY_NONE;
bearish = X121SMC_XWZ_PRIORITY_NONE;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
if (!IsValid(forPeriod))
{
forPeriod = period;
}
//
bool hasWorkingZone = HasWorkingZone();
if (!hasWorkingZone)
{
return;
}
//
XOHCL zBar;
bool isInited = zBar.Init(
symbol,
forPeriod,
barIndex //
);
if (!isInited)
{
//
zBar.Clean();
return;
}
//
XOHCL cBar;
isInited = zBar.GetPreviousBar(cBar);
if (!isInited)
{
//
zBar.Clean();
cBar.Clean();
return;
}
//
// ZoneUpper, Upper ...
if (cBar.low > workingZone.upper &&
cBar.high < workingZone.zoneUpper &&
zBar.low > workingZone.upper &&
zBar.high < workingZone.zoneUpper)
{
//
bullish = X121SMC_XWZ_PRIORITY_NONE;
bearish = X121SMC_XWZ_PRIORITY_STRONG_HIGH;
}
//
// Upper, Quarter1 ...
else if (cBar.low > workingZone.quarter1 &&
cBar.high < workingZone.upper &&
zBar.low > workingZone.quarter1 &&
zBar.high < workingZone.upper)
{
//
bullish = X121SMC_XWZ_PRIORITY_WEAK;
bearish = X121SMC_XWZ_PRIORITY_HIGH;
}
//
// Quarter1, Quarter2 ...
else if (cBar.low > workingZone.quarter2 &&
cBar.high < workingZone.quarter1 &&
zBar.low > workingZone.quarter2 &&
zBar.high < workingZone.quarter1)
{
//
bullish = X121SMC_XWZ_PRIORITY_LOW;
bearish = X121SMC_XWZ_PRIORITY_REGULAR;
}
//
// Quarter2, Quarter3 ...
else if (cBar.low > workingZone.quarter3 &&
cBar.high < workingZone.quarter2 &&
zBar.low > workingZone.quarter3 &&
zBar.high < workingZone.quarter2)
{
//
bullish = X121SMC_XWZ_PRIORITY_REGULAR;
bearish = X121SMC_XWZ_PRIORITY_LOW;
}
//
// Quarter3, Lower ...
else if (cBar.low > workingZone.lower &&
cBar.high < workingZone.quarter3 &&
zBar.low > workingZone.lower &&
zBar.high < workingZone.quarter3)
{
//
bullish = X121SMC_XWZ_PRIORITY_HIGH;
bearish = X121SMC_XWZ_PRIORITY_WEAK;
}
//
// Lower, ZoneLower ...
else if (cBar.low > workingZone.zoneLower &&
cBar.high < workingZone.lower &&
zBar.low > workingZone.zoneLower &&
zBar.high < workingZone.lower)
{
//
bullish = X121SMC_XWZ_PRIORITY_STRONG_HIGH;
bearish = X121SMC_XWZ_PRIORITY_NONE;
}
//
zBar.Clean();
cBar.Clean();
}
//
double GetEntry()
{