This commit is contained in:
2025-01-18 12:16:28 +03:30
parent 9cdd5b4c7d
commit e74f64c51e
10 changed files with 2111 additions and 1003 deletions
+122 -64
View File
@@ -309,35 +309,18 @@ bool DetectX121SMCGuards(
//
// Trigger ...
ENUM_X_DIRECTION triggerMarketDir;
bool hasTriggerMarketDir = triggerCycleHelper
.DetectMarketStructure(triggerMarketDir);
//
bool hasTriggerBullishTrend =
hasTriggerMarketDir &&
IsBullish(triggerMarketDir);
//
bool hasTriggerBearishTrend =
hasTriggerMarketDir &&
IsBearish(triggerMarketDir);
bool hasTriggerBullishTrend = triggerXConditions.bullishTrendBuffer[1];
bool hasTriggerBearishTrend = triggerXConditions.bearishTrendBuffer[1];
//
// Decision ...
ENUM_X_DIRECTION decisionMarketDir;
bool hasDecisionMarketDir = decisionCycleHelper
.DetectMarketStructure(decisionMarketDir);
bool hasDecisionBullishTrend = decisionXConditions.bullishTrendBuffer[1];
bool hasDecisionBearishTrend = decisionXConditions.bearishTrendBuffer[1];
//
bool hasDecisionBullishTrend =
hasDecisionMarketDir &&
IsBullish(decisionMarketDir);
//
bool hasDecisionBearishTrend =
hasDecisionMarketDir &&
IsBearish(decisionMarketDir);
// Analyse ...
bool hasAnalyseBullishTrend = analyseXConditions.bullishTrendBuffer[1];
bool hasAnalyseBearishTrend = analyseXConditions.bearishTrendBuffer[1];
//
// Consolidation Zone ...
@@ -884,6 +867,9 @@ bool DetectX121SMCGuards(
iGuard.provider = provider;
iGuard.action = X_121_SMC_GUARD_ACTION_CLOSE;
//
iGuard.ticket = iPosition.ticket;
//
AddGuard(
iGuard,
@@ -892,6 +878,92 @@ bool DetectX121SMCGuards(
}
}
//
if (hasLongs)
{
//
bool hasGuard = hasDecisionBearishTrend;
//
if (hasGuard)
{
//
for (int i = 0; i < longsCount; i++)
{
//
XPosition iPosition = ownLongPositions[i];
//
// Position must be in Draw Down ...
if (iPosition.profit > 0)
{
continue;
}
//
X121SMCGuard iGuard;
//
iGuard.time = cTime;
iGuard.symbol = symbol;
iGuard.provider = provider;
iGuard.action = X_121_SMC_GUARD_ACTION_CLOSE;
//
iGuard.ticket = iPosition.ticket;
//
AddGuard(
iGuard,
guards //
);
}
}
}
//
if (hasShorts)
{
//
bool hasGuard = hasDecisionBullishTrend;
//
if (hasGuard)
{
//
for (int i = 0; i < shortsCount; i++)
{
//
XPosition iPosition = ownShortPositions[i];
//
// Position must be in Draw Down ...
if (iPosition.profit > 0)
{
continue;
}
//
X121SMCGuard iGuard;
//
iGuard.time = cTime;
iGuard.symbol = symbol;
iGuard.provider = provider;
iGuard.action = X_121_SMC_GUARD_ACTION_CLOSE;
//
iGuard.ticket = iPosition.ticket;
//
AddGuard(
iGuard,
guards //
);
}
}
}
//
// Close All ...
@@ -931,6 +1003,7 @@ bool DetectX121SMCGuards(
//
bool hasGuard =
//
hasAnalyseBearishTrend &&
hasDecisionBearishTrend
//
;
@@ -962,6 +1035,7 @@ bool DetectX121SMCGuards(
//
bool hasGuard =
//
hasAnalyseBullishTrend &&
hasDecisionBullishTrend
//
;
@@ -998,20 +1072,6 @@ bool DetectX121SMCGuards(
hasTriggerBearishTrend ||
!hasDecisionBullishTrend
//
// (hasAnalysePriceZone &&
// isAnalysePriceZoneBearish &&
// isAnalysePriceZoneValidForPeak &&
// (isAnalysePriceZoneUpperRejected ||
// isAnalysePriceZoneLowerBreakedDown))
// //
// ||
// //
// (hasVerificationPriceZone &&
// isVerificationPriceZoneBearish &&
// isVerificationPriceZoneValidForPeak &&
// (isVerificationPriceZoneUpperRejected ||
// isVerificationPriceZoneLowerBreakedDown))
//
;
//
@@ -1054,20 +1114,6 @@ bool DetectX121SMCGuards(
hasTriggerBullishTrend ||
!hasDecisionBearishTrend
//
// (hasAnalysePriceZone &&
// isAnalysePriceZoneBullish &&
// isAnalysePriceZoneValidForVale &&
// (isAnalysePriceZoneLowerRejected ||
// isAnalysePriceZoneUpperBreakedUp))
// //
// ||
// //
// (hasVerificationPriceZone &&
// isVerificationPriceZoneBullish &&
// isVerificationPriceZoneValidForVale &&
// (isVerificationPriceZoneLowerRejected ||
// isVerificationPriceZoneUpperBreakedUp))
//
;
//
@@ -1107,6 +1153,9 @@ bool DetectX121SMCGuards(
//
if (hasLongs)
{
//
bool hasTrendGuard = hasDecisionBearishTrend;
//
bool hasConsolidationGuard =
(hasConsolidationZone &&
@@ -1137,6 +1186,7 @@ bool DetectX121SMCGuards(
//
bool hasGuard =
//
hasTrendGuard ||
hasConsolidationGuard ||
hasDecisionPriceZoneGuard ||
hasAnalysePriceZoneGuard ||
@@ -1172,6 +1222,12 @@ bool DetectX121SMCGuards(
continue;
}
//
if (hasTrendGuard)
{
guardStop = decisionXConditions.strBuffer[1] - decisionXConditions.atrBuffer[1];
}
//
// Price Must Greater than Zone Lower ...
if (iPosition.price < guardStop)
@@ -1203,11 +1259,9 @@ bool DetectX121SMCGuards(
iGuard.provider = provider;
iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_STOP;
//
iGuard.ticket = iPosition.ticket;
//
iGuard.sl = guardStop;
iGuard.ticket = iPosition.ticket;
//
AddGuard(
@@ -1221,6 +1275,9 @@ bool DetectX121SMCGuards(
//
if (hasShorts)
{
//
bool hasTrendGuard = hasDecisionBullishTrend;
//
bool hasConsolidationGuard =
(hasConsolidationZone &&
@@ -1251,6 +1308,7 @@ bool DetectX121SMCGuards(
//
bool hasGuard =
//
hasTrendGuard ||
hasConsolidationGuard ||
hasDecisionPriceZoneGuard ||
hasAnalysePriceZoneGuard ||
@@ -1286,6 +1344,12 @@ bool DetectX121SMCGuards(
continue;
}
//
if (hasTrendGuard)
{
guardStop = decisionXConditions.strBuffer[1] + decisionXConditions.atrBuffer[1];
}
//
// Price Must Lesser than Zone Upper ...
if (iPosition.price > guardStop)
@@ -1317,11 +1381,9 @@ bool DetectX121SMCGuards(
iGuard.provider = provider;
iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_STOP;
//
iGuard.ticket = iPosition.ticket;
//
iGuard.sl = guardStop;
iGuard.ticket = iPosition.ticket;
//
AddGuard(
@@ -1397,11 +1459,9 @@ bool DetectX121SMCGuards(
iGuard.provider = provider;
iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_TARGET;
//
iGuard.ticket = iPosition.ticket;
//
iGuard.tp = guardTP;
iGuard.ticket = iPosition.ticket;
//
AddGuard(
@@ -1474,11 +1534,9 @@ bool DetectX121SMCGuards(
iGuard.provider = provider;
iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_TARGET;
//
iGuard.ticket = iPosition.ticket;
//
iGuard.tp = guardTP;
iGuard.ticket = iPosition.ticket;
//
AddGuard(