This commit is contained in:
2024-07-24 23:56:40 +03:30
parent 53090256e3
commit 11b8554ab7
2 changed files with 255 additions and 110 deletions
+1 -1
View File
@@ -328,7 +328,7 @@ bool InitialEA()
eurusdSymbol, eurusdSymbol,
PERIOD_M5, PERIOD_M5,
eaVolume, eaVolume,
eaR2R, // R2R ... 1, // eaR2R, // R2R ...
eaSlippage, eaSlippage,
magicNumber, magicNumber,
true, // Ignore Signal Execution true, // Ignore Signal Execution
+234 -89
View File
@@ -24,6 +24,9 @@
// //
// Import(s) Helper(s) ... // Import(s) Helper(s) ...
#include "../Helpers/x-saherelm.xpv.helper.mq5"
#include "../Helpers/x-saherelm.xstr.helper.mq5"
#include "../Helpers/x-saherelm.xche.helper.mq5"
#include "../Helpers/x-saherelm.xchma.helper.mq5" #include "../Helpers/x-saherelm.xchma.helper.mq5"
#include "../Helpers/x-saherelm.xchhk.helper.mq5" #include "../Helpers/x-saherelm.xchhk.helper.mq5"
@@ -94,6 +97,11 @@ public:
// Deconstructor ... // Deconstructor ...
void ~XSCXCHKMStrategy() void ~XSCXCHKMStrategy()
{ {
//
delete pvHelper;
delete strHelper;
delete cheHelper;
// //
delete chhkHelper; delete chhkHelper;
delete chmaHelper; delete chmaHelper;
@@ -377,7 +385,7 @@ public:
// //
// Bullish XCHMA Conditions ... // Bullish XCHMA Conditions ...
bool isCHMACrossedOver = bool isCHMABullish =
// //
isCHMAHCrossedOver isCHMAHCrossedOver
// //
@@ -456,7 +464,7 @@ public:
// //
// Bullish XCHMA Conditions ... // Bullish XCHMA Conditions ...
bool isCHMACrossedUnder = bool isCHMABearish =
// //
isCHMAHCrossedUnder isCHMAHCrossedUnder
// //
@@ -474,6 +482,91 @@ public:
// //
; ;
//
// Max ...
double maxCHMA = MathMax(
chmaConditions.cFast[cIndex],
chmaConditions.cSlow[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.sFast[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.sSlow[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.mFast[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.mSlow[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.lFast[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.lSlow[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.hFast[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.hSlow[cIndex] //
);
//
// Min
double minCHMA = MathMin(
chmaConditions.cFast[cIndex],
chmaConditions.cSlow[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.sFast[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.sSlow[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.mFast[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.mSlow[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.lFast[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.lSlow[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.hFast[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.hSlow[cIndex] //
);
//
double chmaDistanceDiffInPoint =
//
(maxCHMA - minCHMA) / points
//
;
// //
// XCHHM Conditions ... // XCHHM Conditions ...
@@ -676,91 +769,6 @@ public:
// //
; ;
//
// Max ...
double maxCHMA = MathMax(
chmaConditions.cFast[cIndex],
chmaConditions.cSlow[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.sFast[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.sSlow[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.mFast[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.mSlow[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.lFast[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.lSlow[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.hFast[cIndex] //
);
maxCHMA = MathMax(
maxCHMA,
chmaConditions.hSlow[cIndex] //
);
//
// Min
double minCHMA = MathMin(
chmaConditions.cFast[cIndex],
chmaConditions.cSlow[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.sFast[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.sSlow[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.mFast[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.mSlow[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.lFast[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.lSlow[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.hFast[cIndex] //
);
minCHMA = MathMin(
minCHMA,
chmaConditions.hSlow[cIndex] //
);
//
double chmaDistanceDiffInPoint =
//
(maxCHMA - minCHMA) / points
//
;
// //
// Bearish ... // Bearish ...
@@ -1049,6 +1057,65 @@ public:
// //
// Preparing Signals for Execution ... // Preparing Signals for Execution ...
bool allowCHHKSignals = true;
bool allowCHMASignals = false;
//
// XCHMA ...
if (allowCHMASignals)
{
//
double pressureDistance = 200;
//
if (isCHMABullish)
{
//
hasLong =
//
isCHMABullish &&
hasBullishPattern &&
chmaDistanceDiffInPoint <= pressureDistance
//
;
//
if (hasLong)
{
//
type = POSITION_TYPE_SELL;
sl = minCHMA;
}
}
//
if (isCHMABearish)
{
//
hasShort =
//
isCHMABearish &&
hasBearishPattern &&
chmaDistanceDiffInPoint <= pressureDistance
//
;
//
if (hasShort)
{
//
type = POSITION_TYPE_SELL;
sl = minCHMA;
}
}
}
//
// XCHHK ...
if (allowCHHKSignals)
{
//
double pressureDistance = 200;
// //
if (isCHHKBullish) if (isCHHKBullish)
@@ -1058,7 +1125,7 @@ public:
// //
isCHHKBullish && isCHHKBullish &&
hasBullishPattern && hasBullishPattern &&
chhkDistanceDiffInPoint <= 250 chhkDistanceDiffInPoint <= pressureDistance
// //
; ;
@@ -1079,7 +1146,7 @@ public:
// //
isCHHKBearish && isCHHKBearish &&
hasBearishPattern && hasBearishPattern &&
chhkDistanceDiffInPoint <= 250 chhkDistanceDiffInPoint <= pressureDistance
// //
; ;
@@ -1091,6 +1158,7 @@ public:
sl = minCHHKHigh; sl = minCHHKHigh;
} }
} }
}
// //
// forceCloseLongs = isCHHKBullishBreaked; // forceCloseLongs = isCHHKBullishBreaked;
@@ -1199,6 +1267,21 @@ protected:
XOHCL support; XOHCL support;
XOHCL resistance; XOHCL resistance;
//
// XPV ...
XPVInputs pvInputs;
XSCXPVHelper *pvHelper;
//
// XSTR ...
XSTRInputs strInputs;
XSCXSTRHelper *strHelper;
//
// XCHE ...
XCHEInputs cheInputs;
XSCXCHEHelper *cheHelper;
// //
// XHK ... // XHK ...
XCHHKInputs chhkInputs; XCHHKInputs chhkInputs;
@@ -1276,6 +1359,68 @@ private:
mPeriod, mPeriod,
chhkInputs // chhkInputs //
); );
//
// XPV ...
//
pvInputs.Default();
//
pvInputs.showPeaksAndVales = true;
pvInputs.showLevels = false;
pvInputs.showConsolidations = false;
pvInputs.showFibo1Levels = false;
pvInputs.showFibo2Levels = false;
pvInputs.showFibo3Levels = false;
pvInputs.showFibo4Levels = false;
pvInputs.showFibo5Levels = false;
//
pvHelper = new XSCXPVHelper();
pvHelper.Init(
mSymbol,
mPeriod,
pvInputs //
);
//
// XSTR ...
//
strInputs.Default();
//
strInputs.showTrends = true;
strInputs.fillTrends = false;
//
strHelper = new XSCXPVHelper();
strHelper.Init(
mSymbol,
mPeriod,
strInputs //
);
//
// XCHE ...
//
cheInputs.Default();
//
cheInputs.showLongExit1Line = true;
cheInputs.showShortExit1Line = true;
cheInputs.showLongExit2Line = true;
cheInputs.showShortExit2Line = true;
//
cheHelper = new XSCXPVHelper();
cheHelper.Init(
mSymbol,
mPeriod,
cheInputs //
);
} }
// //