last ...
This commit is contained in:
@@ -38,12 +38,42 @@ bool DetectX121SMCGuards(
|
||||
XC121SMCCycleHelper *analyseCycleHelper,
|
||||
XC121SMCCycleHelper *verificationCycleHelper,
|
||||
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||
XC121SMCCycleHelper *visionCycleHelper //
|
||||
XC121SMCCycleHelper *visionCycleHelper,
|
||||
//
|
||||
// Guard Types ...
|
||||
bool ignoreCloseOnTPNearGuard = false,
|
||||
bool ignoreCloseLongsOnBearishTrendGuard = false,
|
||||
bool ignoreCloseShortsOnBullishTrendGuard = false,
|
||||
bool ignoreCloseAllWeekendGuard = false,
|
||||
bool ignorePartialCloseOnTrendChangeGuard = false,
|
||||
bool ignoreTrailStopGuard = false,
|
||||
bool ignoreTrailTargetGuard = false,
|
||||
bool ignoreHedgeGuard = false
|
||||
//
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
bool isAllIgnore =
|
||||
//
|
||||
ignoreCloseOnTPNearGuard &&
|
||||
ignoreCloseLongsOnBearishTrendGuard &&
|
||||
ignoreCloseShortsOnBullishTrendGuard &&
|
||||
ignoreCloseAllWeekendGuard &&
|
||||
ignorePartialCloseOnTrendChangeGuard &&
|
||||
ignoreTrailStopGuard &&
|
||||
ignoreTrailTargetGuard &&
|
||||
ignoreHedgeGuard
|
||||
//
|
||||
;
|
||||
result = !isAllIgnore;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(positions);
|
||||
result = IsValidSize(count);
|
||||
@@ -116,6 +146,18 @@ bool DetectX121SMCGuards(
|
||||
result = IsValidSize(count);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Clean(ownPositions);
|
||||
Clean(ownLongPositions);
|
||||
Clean(ownShortPositions);
|
||||
|
||||
//
|
||||
x121SMCAnalysePriceZone.Clean();
|
||||
x121SMCDecisionPriceZone.Clean();
|
||||
x121SMCConsolidationZone.Clean();
|
||||
x121SMCVerificationPriceZone.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -353,7 +395,13 @@ bool DetectX121SMCGuards(
|
||||
IsBearish(analyseTrendDir);
|
||||
|
||||
//
|
||||
// Consolidation Zone ...
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Detect Consolidation Zone ...
|
||||
|
||||
//
|
||||
int consolidationLoopback = 7;
|
||||
double consolidationZoneLower = 0;
|
||||
double consolidationZoneUpper = 0;
|
||||
@@ -822,8 +870,13 @@ bool DetectX121SMCGuards(
|
||||
// Here We Have all Requirements for Guarding Positions ...
|
||||
|
||||
//
|
||||
// Close ...
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Close ...
|
||||
if (!ignoreCloseOnTPNearGuard)
|
||||
{
|
||||
//
|
||||
double tpCloseDiff = (15 * points);
|
||||
for (int i = 0; i < count; i++)
|
||||
@@ -907,9 +960,13 @@ bool DetectX121SMCGuards(
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (hasLongs)
|
||||
{
|
||||
//
|
||||
if (!ignoreCloseLongsOnBearishTrendGuard)
|
||||
{
|
||||
//
|
||||
bool hasGuard = hasDecisionBearishTrend;
|
||||
@@ -950,9 +1007,13 @@ bool DetectX121SMCGuards(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (hasShorts)
|
||||
{
|
||||
//
|
||||
if (!ignoreCloseShortsOnBullishTrendGuard)
|
||||
{
|
||||
//
|
||||
bool hasGuard = hasDecisionBullishTrend;
|
||||
@@ -993,10 +1054,15 @@ bool DetectX121SMCGuards(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Close All ...
|
||||
|
||||
//
|
||||
// Close All Weekend ...
|
||||
if (!ignoreCloseAllWeekendGuard)
|
||||
{
|
||||
//
|
||||
MqlDateTime mDate;
|
||||
bool hasDate = TimeCurrent(mDate);
|
||||
@@ -1025,6 +1091,7 @@ bool DetectX121SMCGuards(
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Close Longs ...
|
||||
@@ -1093,6 +1160,9 @@ bool DetectX121SMCGuards(
|
||||
//
|
||||
// Partial Close ...
|
||||
|
||||
//
|
||||
if (!ignorePartialCloseOnTrendChangeGuard)
|
||||
{
|
||||
//
|
||||
if (hasLongs)
|
||||
{
|
||||
@@ -1176,10 +1246,12 @@ bool DetectX121SMCGuards(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Trail Stop ...
|
||||
|
||||
if (!ignoreTrailStopGuard)
|
||||
{
|
||||
//
|
||||
if (hasLongs)
|
||||
{
|
||||
@@ -1423,10 +1495,12 @@ bool DetectX121SMCGuards(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Trail Target ...
|
||||
|
||||
if (!ignoreTrailTargetGuard)
|
||||
{
|
||||
//
|
||||
if (hasLongs)
|
||||
{
|
||||
@@ -1576,10 +1650,27 @@ bool DetectX121SMCGuards(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Hedge ...
|
||||
// TODO: Implement Hedge ...
|
||||
if (!ignoreHedgeGuard)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Collections ...
|
||||
|
||||
//
|
||||
Clean(ownPositions);
|
||||
Clean(ownLongPositions);
|
||||
Clean(ownShortPositions);
|
||||
|
||||
//
|
||||
x121SMCAnalysePriceZone.Clean();
|
||||
x121SMCDecisionPriceZone.Clean();
|
||||
x121SMCConsolidationZone.Clean();
|
||||
x121SMCVerificationPriceZone.Clean();
|
||||
|
||||
//
|
||||
// Release Arrays ...
|
||||
|
||||
@@ -1597,17 +1597,27 @@ bool DetectX121SMCXGuards(
|
||||
string provider = ToString(X_121_SMC_PROVIDER_X);
|
||||
|
||||
//
|
||||
// result = DetectX121SMCGuards(
|
||||
// provider,
|
||||
// guards,
|
||||
// positions,
|
||||
// triggerCycleHelper,
|
||||
// decisionCycleHelper,
|
||||
// analyseCycleHelper,
|
||||
// verificationCycleHelper,
|
||||
// consolidationCycleHelper,
|
||||
// visionCycleHelper //
|
||||
// );
|
||||
result = DetectX121SMCGuards(
|
||||
provider,
|
||||
guards,
|
||||
positions,
|
||||
triggerCycleHelper,
|
||||
decisionCycleHelper,
|
||||
analyseCycleHelper,
|
||||
verificationCycleHelper,
|
||||
consolidationCycleHelper,
|
||||
visionCycleHelper,
|
||||
//
|
||||
true, // CloseOnTPNear Guard ...
|
||||
true, // CloseLongsOnBearishTrend Guard ...
|
||||
true, // CloseShortsOnBullishTrend Guard ...
|
||||
true, // CloseAllWeekend Guard ...
|
||||
true, // PartialCloseOnTrendChange Guard ...
|
||||
true, // TrailStop Guard ...
|
||||
true, // TrailTarget Guard ...
|
||||
true // Hedge Guard ...
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
|
||||
@@ -1383,17 +1383,27 @@ bool DetectX121SMCXOBPVGuards(
|
||||
string provider = ToString(X_121_SMC_PROVIDER_X);
|
||||
|
||||
//
|
||||
// result = DetectX121SMCGuards(
|
||||
// provider,
|
||||
// guards,
|
||||
// positions,
|
||||
// triggerCycleHelper,
|
||||
// decisionCycleHelper,
|
||||
// analyseCycleHelper,
|
||||
// verificationCycleHelper,
|
||||
// consolidationCycleHelper,
|
||||
// visionCycleHelper //
|
||||
// );
|
||||
result = DetectX121SMCGuards(
|
||||
provider,
|
||||
guards,
|
||||
positions,
|
||||
triggerCycleHelper,
|
||||
decisionCycleHelper,
|
||||
analyseCycleHelper,
|
||||
verificationCycleHelper,
|
||||
consolidationCycleHelper,
|
||||
visionCycleHelper,
|
||||
//
|
||||
true, // CloseOnTPNear Guard ...
|
||||
true, // CloseLongsOnBearishTrend Guard ...
|
||||
true, // CloseShortsOnBullishTrend Guard ...
|
||||
true, // CloseAllWeekend Guard ...
|
||||
true, // PartialCloseOnTrendChange Guard ...
|
||||
true, // TrailStop Guard ...
|
||||
true, // TrailTarget Guard ...
|
||||
true // Hedge Guard ...
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user