complete XHK Indicator and it's related Helper and also Attached it to x121 Helper ...

This commit is contained in:
2025-01-25 21:42:37 +03:30
parent 6959bc83db
commit 8e502953a3
4 changed files with 1923 additions and 261 deletions
+248 -3
View File
@@ -25,6 +25,7 @@
#include "../Helpers/x-saherelm.x121.xatr.helper.mq5"
#include "../Helpers/x-saherelm.x121.xche.helper.mq5"
#include "../Helpers/x-saherelm.x121.xdon.helper.mq5"
#include "../Helpers/x-saherelm.x121.xhk.helper.mq5"
#include "../Helpers/x-saherelm.x121.xpv.helper.mq5"
#include "../Helpers/x-saherelm.x121.xstr.helper.mq5"
#include "../Helpers/x-saherelm.x121.xvwap.helper.mq5"
@@ -37,6 +38,7 @@ struct X121Inputs
// Props ...
bool showRSI;
X121XPVInputs xpvInputs;
X121XHKInputs xhkInputs;
X121XATRInputs xatrInputs;
X121XSTRInputs xstrInputs;
X121XCHEInputs xcheInputs;
@@ -60,6 +62,7 @@ struct X121Inputs
{
//
xpvInputs.Clean();
xhkInputs.Clean();
xatrInputs.Clean();
xstrInputs.Clean();
xcheInputs.Clean();
@@ -74,6 +77,7 @@ struct X121Inputs
{
//
xpvInputs.Default();
xhkInputs.Default();
xatrInputs.Default();
xstrInputs.Default();
xcheInputs.Default();
@@ -95,6 +99,7 @@ struct X121Inputs
result =
//
xpvInputs.IsValid() &&
xhkInputs.IsValid() &&
xatrInputs.IsValid() &&
xstrInputs.IsValid() &&
xcheInputs.IsValid() &&
@@ -119,6 +124,7 @@ struct X121Inputs
//
int xpvMax = xpvInputs.Max();
int xhkMax = xpvInputs.Max();
int xatrMax = xatrInputs.Max();
int xstrMax = xstrInputs.Max();
int xcheMax = xcheInputs.Max();
@@ -126,7 +132,8 @@ struct X121Inputs
int xvwapMax = xvwapInputs.Max();
//
result = MathMax(xpvMax, xatrMax);
result = MathMax(xpvMax, xpvMax);
result = MathMax(result, xatrMax);
result = MathMax(result, xstrMax);
result = MathMax(result, xcheMax);
result = MathMax(result, xdonMax);
@@ -183,8 +190,16 @@ struct X121Conditions
double strStateBuffer[];
double vwapFastBuffer[];
double vwapSlowBuffer[];
double xhkSMLowBuffer[];
double vwapPriceBuffer[];
double xhkRawLowBuffer[];
double xhkSMOpenBuffer[];
double xhkSMHighBuffer[];
double xhkRawOpenBuffer[];
double xhkRawHighBuffer[];
double xhkSMCloseBuffer[];
double vwapVolumeBuffer[];
double xhkRawCloseBuffer[];
double atrUpperRawBuffer[];
double atrLowerRawBuffer[];
double donLowUpperBuffer[];
@@ -352,6 +367,32 @@ struct X121Conditions
bool isVWapSwitchedToBullishOrdered;
bool isVWapSwitchedToBearishOrdered;
//
bool isSMHKBullish;
bool isRawHKBullish;
bool isSMHKBearish;
bool isRawHKBearish;
bool isBreakedUpSMHK;
bool isBreakedUpRawHK;
bool isRejectedUpSMHK;
bool isClosedOverSMHK;
bool isRejectedUpRawHK;
bool isBreakedDownSMHK;
bool isClosedUnderSMHK;
bool isClosedOverRawHK;
bool isClosedUnderRawHK;
bool isBreakedDownRawHK;
bool isRejectedDownSMHK;
bool isRejectedDownRawHK;
bool isRawHKBreakedUpSMHK;
bool isRawHKClosedOverSMHK;
bool isSMHKSwitchedBearish;
bool isRawHKSwitchedBearish;
bool isRawHKClosedUnderSMHK;
bool isRawHKBreakedDownSMHK;
bool isSMHKSwitchedToBullish;
bool isRawHKSwitchedToBullish;
//
// Complex Conditions ...
double cheMin;
@@ -562,10 +603,10 @@ struct X121Conditions
Clean(lLLBuffer);
Clean(hHHBuffer);
Clean(hLLBuffer);
Clean(volumeBuffer);
Clean(peaksBuffer);
Clean(valesBuffer);
Clean(strUpBuffer);
Clean(volumeBuffer);
Clean(strDownBuffer);
Clean(vwapMidBuffer);
Clean(le1StartBuffer);
@@ -578,8 +619,16 @@ struct X121Conditions
Clean(strStateBuffer);
Clean(vwapFastBuffer);
Clean(vwapSlowBuffer);
Clean(xhkSMLowBuffer);
Clean(vwapPriceBuffer);
Clean(xhkRawLowBuffer);
Clean(xhkSMOpenBuffer);
Clean(xhkSMHighBuffer);
Clean(xhkRawOpenBuffer);
Clean(xhkRawHighBuffer);
Clean(xhkSMCloseBuffer);
Clean(vwapVolumeBuffer);
Clean(xhkRawCloseBuffer);
Clean(atrUpperRawBuffer);
Clean(atrLowerRawBuffer);
Clean(donLowUpperBuffer);
@@ -613,10 +662,10 @@ struct X121Conditions
ArraySetAsSeries(lLLBuffer, true);
ArraySetAsSeries(hHHBuffer, true);
ArraySetAsSeries(hLLBuffer, true);
ArraySetAsSeries(volumeBuffer, true);
ArraySetAsSeries(peaksBuffer, true);
ArraySetAsSeries(valesBuffer, true);
ArraySetAsSeries(strUpBuffer, true);
ArraySetAsSeries(volumeBuffer, true);
ArraySetAsSeries(strDownBuffer, true);
ArraySetAsSeries(vwapMidBuffer, true);
ArraySetAsSeries(le1StartBuffer, true);
@@ -629,8 +678,16 @@ struct X121Conditions
ArraySetAsSeries(strStateBuffer, true);
ArraySetAsSeries(vwapFastBuffer, true);
ArraySetAsSeries(vwapSlowBuffer, true);
ArraySetAsSeries(xhkSMLowBuffer, true);
ArraySetAsSeries(vwapPriceBuffer, true);
ArraySetAsSeries(xhkRawLowBuffer, true);
ArraySetAsSeries(xhkSMOpenBuffer, true);
ArraySetAsSeries(xhkSMHighBuffer, true);
ArraySetAsSeries(xhkRawOpenBuffer, true);
ArraySetAsSeries(xhkRawHighBuffer, true);
ArraySetAsSeries(xhkSMCloseBuffer, true);
ArraySetAsSeries(vwapVolumeBuffer, true);
ArraySetAsSeries(xhkRawCloseBuffer, true);
ArraySetAsSeries(atrUpperRawBuffer, true);
ArraySetAsSeries(atrLowerRawBuffer, true);
ArraySetAsSeries(donLowUpperBuffer, true);
@@ -868,6 +925,33 @@ struct X121Conditions
isClosedUnderCheMin = false;
isClosedUnderCheMax = false;
//
// XHK ...
isSMHKBullish = false;
isRawHKBullish = false;
isSMHKBearish = false;
isRawHKBearish = false;
isBreakedUpSMHK = false;
isBreakedUpRawHK = false;
isRejectedUpSMHK = false;
isClosedOverSMHK = false;
isRejectedUpRawHK = false;
isBreakedDownSMHK = false;
isClosedUnderSMHK = false;
isClosedOverRawHK = false;
isClosedUnderRawHK = false;
isBreakedDownRawHK = false;
isRejectedDownSMHK = false;
isRejectedDownRawHK = false;
isRawHKBreakedUpSMHK = false;
isRawHKClosedOverSMHK = false;
isSMHKSwitchedBearish = false;
isRawHKSwitchedBearish = false;
isRawHKClosedUnderSMHK = false;
isRawHKBreakedDownSMHK = false;
isSMHKSwitchedToBullish = false;
isRawHKSwitchedToBullish = false;
//
// Complex Conditions ...
@@ -1217,6 +1301,34 @@ struct X121Conditions
ToString("isClosedUnderCheMax", isClosedUnderCheMax, ignoreFalseConditions, separator) +
//
"-----------------------" + separator +
"HK ..." + separator +
"-----------------------" + separator +
ToString("isSMHKBullish", isSMHKBullish, ignoreFalseConditions, separator) +
ToString("isRawHKBullish", isRawHKBullish, ignoreFalseConditions, separator) +
ToString("isSMHKBearish", isSMHKBearish, ignoreFalseConditions, separator) +
ToString("isRawHKBearish", isRawHKBearish, ignoreFalseConditions, separator) +
ToString("isBreakedUpSMHK", isBreakedUpSMHK, ignoreFalseConditions, separator) +
ToString("isBreakedUpRawHK", isBreakedUpRawHK, ignoreFalseConditions, separator) +
ToString("isRejectedUpSMHK", isRejectedUpSMHK, ignoreFalseConditions, separator) +
ToString("isClosedOverSMHK", isClosedOverSMHK, ignoreFalseConditions, separator) +
ToString("isRejectedUpRawHK", isRejectedUpRawHK, ignoreFalseConditions, separator) +
ToString("isBreakedDownSMHK", isBreakedDownSMHK, ignoreFalseConditions, separator) +
ToString("isClosedUnderSMHK", isClosedUnderSMHK, ignoreFalseConditions, separator) +
ToString("isClosedOverRawHK", isClosedOverRawHK, ignoreFalseConditions, separator) +
ToString("isClosedUnderRawHK", isClosedUnderRawHK, ignoreFalseConditions, separator) +
ToString("isBreakedDownRawHK", isBreakedDownRawHK, ignoreFalseConditions, separator) +
ToString("isRejectedDownSMHK", isRejectedDownSMHK, ignoreFalseConditions, separator) +
ToString("isRejectedDownRawHK", isRejectedDownRawHK, ignoreFalseConditions, separator) +
ToString("isRawHKBreakedUpSMHK", isRawHKBreakedUpSMHK, ignoreFalseConditions, separator) +
ToString("isRawHKClosedOverSMHK", isRawHKClosedOverSMHK, ignoreFalseConditions, separator) +
ToString("isSMHKSwitchedBearish", isSMHKSwitchedBearish, ignoreFalseConditions, separator) +
ToString("isRawHKSwitchedBearish", isRawHKSwitchedBearish, ignoreFalseConditions, separator) +
ToString("isRawHKClosedUnderSMHK", isRawHKClosedUnderSMHK, ignoreFalseConditions, separator) +
ToString("isRawHKBreakedDownSMHK", isRawHKBreakedDownSMHK, ignoreFalseConditions, separator) +
ToString("isSMHKSwitchedToBullish", isSMHKSwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isRawHKSwitchedToBullish", isRawHKSwitchedToBullish, ignoreFalseConditions, separator) +
//
"-----------------------" + separator +
"Slopes ..." + separator +
"-----------------------" + separator +
ToString("isRsiSlopeBullish", isRsiSlopeBullish, ignoreFalseConditions, separator) +
@@ -1372,6 +1484,7 @@ class XCX121Helper : public XCBase
//
// Helpers ...
XCX121XPVHelper *xpvHelper;
XCX121XHKHelper *xhkHelper;
XCX121XATRHelper *xatrHelper;
XCX121XSTRHelper *xstrHelper;
XCX121XCHEHelper *xcheHelper;
@@ -1390,6 +1503,7 @@ class XCX121Helper : public XCBase
{
//
delete xpvHelper;
delete xhkHelper;
delete xatrHelper;
delete xstrHelper;
delete xcheHelper;
@@ -1450,6 +1564,7 @@ class XCX121Helper : public XCBase
//
mInputs = inputs;
xpvInputs = inputs.xpvInputs;
xhkInputs = inputs.xhkInputs;
xatrInputs = inputs.xatrInputs;
xstrInputs = inputs.xstrInputs;
xcheInputs = inputs.xcheInputs;
@@ -1472,6 +1587,19 @@ class XCX121Helper : public XCBase
return result;
}
//
// XHK ...
xhkHelper = new XCX121XHKHelper();
result = xhkHelper.Init(
symbol,
period,
xhkInputs //
);
if (!result)
{
return result;
}
//
// XATR ...
xatrHelper = new XCX121XATRHelper();
@@ -1585,6 +1713,28 @@ class XCX121Helper : public XCBase
return result;
}
//
// XHK ...
bool GetHKConditions(
X121XHKConditions &conditions, //
int barIndex = 0, //
int loopback = 5 //
)
{
//
bool result = false;
//
result = xhkHelper.GetConditions(
conditions,
barIndex,
loopback //
);
//
return result;
}
//
// XATR ...
bool GetATRConditions(
@@ -1774,6 +1924,19 @@ class XCX121Helper : public XCBase
return result;
}
//
// XHK ...
X121XHKConditions xhkConditions;
result = GetHKConditions(
xhkConditions,
barIndex,
loopback //
);
if (!result)
{
return result;
}
//
// XATR ...
X121XATRConditions xatrConditions;
@@ -1969,6 +2132,87 @@ class XCX121Helper : public XCBase
conditions.isSarSwitchedToBullish = xpvConditions.isSarSwitchedToBullish;
conditions.isSarSwitchedToBearish = xpvConditions.isSarSwitchedToBearish;
//
// XHK ...
//
// Buffers ...
//
Copy(
xhkConditions.xhkRawOpenBuffer,
conditions.xhkRawOpenBuffer //
);
//
Copy(
xhkConditions.xhkRawHighBuffer,
conditions.xhkRawHighBuffer //
);
//
Copy(
xhkConditions.xhkRawLowBuffer,
conditions.xhkRawLowBuffer //
);
//
Copy(
xhkConditions.xhkRawCloseBuffer,
conditions.xhkRawCloseBuffer //
);
//
Copy(
xhkConditions.xhkSMOpenBuffer,
conditions.xhkSMOpenBuffer //
);
//
Copy(
xhkConditions.xhkSMHighBuffer,
conditions.xhkSMHighBuffer //
);
//
Copy(
xhkConditions.xhkSMLowBuffer,
conditions.xhkSMLowBuffer //
);
//
Copy(
xhkConditions.xhkSMCloseBuffer,
conditions.xhkSMCloseBuffer //
);
//
// Conditions ...
conditions.isSMHKBullish = xhkConditions.isSMHKBullish;
conditions.isRawHKBullish = xhkConditions.isRawHKBullish;
conditions.isSMHKBearish = xhkConditions.isSMHKBearish;
conditions.isRawHKBearish = xhkConditions.isRawHKBearish;
conditions.isBreakedUpSMHK = xhkConditions.isBreakedUpSMHK;
conditions.isBreakedUpRawHK = xhkConditions.isBreakedUpRawHK;
conditions.isRejectedUpSMHK = xhkConditions.isRejectedUpSMHK;
conditions.isClosedOverSMHK = xhkConditions.isClosedOverSMHK;
conditions.isRejectedUpRawHK = xhkConditions.isRejectedUpRawHK;
conditions.isBreakedDownSMHK = xhkConditions.isBreakedDownSMHK;
conditions.isClosedUnderSMHK = xhkConditions.isClosedUnderSMHK;
conditions.isClosedOverRawHK = xhkConditions.isClosedOverRawHK;
conditions.isClosedUnderRawHK = xhkConditions.isClosedUnderRawHK;
conditions.isBreakedDownRawHK = xhkConditions.isBreakedDownRawHK;
conditions.isRejectedDownSMHK = xhkConditions.isRejectedDownSMHK;
conditions.isRejectedDownRawHK = xhkConditions.isRejectedDownRawHK;
conditions.isRawHKBreakedUpSMHK = xhkConditions.isRawHKBreakedUpSMHK;
conditions.isRawHKClosedOverSMHK = xhkConditions.isRawHKClosedOverSMHK;
conditions.isSMHKSwitchedBearish = xhkConditions.isSMHKSwitchedBearish;
conditions.isRawHKSwitchedBearish = xhkConditions.isRawHKSwitchedBearish;
conditions.isRawHKClosedUnderSMHK = xhkConditions.isRawHKClosedUnderSMHK;
conditions.isRawHKBreakedDownSMHK = xhkConditions.isRawHKBreakedDownSMHK;
conditions.isSMHKSwitchedToBullish = xhkConditions.isSMHKSwitchedToBullish;
conditions.isRawHKSwitchedToBullish = xhkConditions.isRawHKSwitchedToBullish;
//
// XATR ...
@@ -2919,6 +3163,7 @@ class XCX121Helper : public XCBase
// Inputs ...
X121Inputs mInputs;
X121XPVInputs xpvInputs;
X121XHKInputs xhkInputs;
X121XATRInputs xatrInputs;
X121XDONInputs xdonInputs;
X121XSTRInputs xstrInputs;
File diff suppressed because it is too large Load Diff