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