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
+254 -109
View File
@@ -24,6 +24,9 @@
//
// 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.xchhk.helper.mq5"
@@ -94,6 +97,11 @@ public:
// Deconstructor ...
void ~XSCXCHKMStrategy()
{
//
delete pvHelper;
delete strHelper;
delete cheHelper;
//
delete chhkHelper;
delete chmaHelper;
@@ -377,7 +385,7 @@ public:
//
// Bullish XCHMA Conditions ...
bool isCHMACrossedOver =
bool isCHMABullish =
//
isCHMAHCrossedOver
//
@@ -456,7 +464,7 @@ public:
//
// Bullish XCHMA Conditions ...
bool isCHMACrossedUnder =
bool isCHMABearish =
//
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 ...
@@ -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 ...
@@ -1049,46 +1057,106 @@ public:
//
// Preparing Signals for Execution ...
bool allowCHHKSignals = true;
bool allowCHMASignals = false;
//
if (isCHHKBullish)
// XCHMA ...
if (allowCHMASignals)
{
//
hasLong =
//
isCHHKBullish &&
hasBullishPattern &&
chhkDistanceDiffInPoint <= 250
//
;
double pressureDistance = 200;
//
if (hasLong)
if (isCHMABullish)
{
//
type = POSITION_TYPE_BUY;
sl = maxCHHKLow;
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;
}
}
}
//
if (isCHHKBearish)
// XCHHK ...
if (allowCHHKSignals)
{
//
hasShort =
//
isCHHKBearish &&
hasBearishPattern &&
chhkDistanceDiffInPoint <= 250
//
;
double pressureDistance = 200;
//
if (hasShort)
if (isCHHKBullish)
{
//
type = POSITION_TYPE_SELL;
sl = minCHHKHigh;
hasLong =
//
isCHHKBullish &&
hasBullishPattern &&
chhkDistanceDiffInPoint <= pressureDistance
//
;
//
if (hasLong)
{
//
type = POSITION_TYPE_BUY;
sl = maxCHHKLow;
}
}
//
if (isCHHKBearish)
{
//
hasShort =
//
isCHHKBearish &&
hasBearishPattern &&
chhkDistanceDiffInPoint <= pressureDistance
//
;
//
if (hasShort)
{
//
type = POSITION_TYPE_SELL;
sl = minCHHKHigh;
}
}
}
@@ -1199,6 +1267,21 @@ protected:
XOHCL support;
XOHCL resistance;
//
// XPV ...
XPVInputs pvInputs;
XSCXPVHelper *pvHelper;
//
// XSTR ...
XSTRInputs strInputs;
XSCXSTRHelper *strHelper;
//
// XCHE ...
XCHEInputs cheInputs;
XSCXCHEHelper *cheHelper;
//
// XHK ...
XCHHKInputs chhkInputs;
@@ -1276,6 +1359,68 @@ private:
mPeriod,
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 //
);
}
//