last ...
This commit is contained in:
@@ -26,12 +26,14 @@
|
||||
#include "../Helpers/x-saherelm.x121.xatr.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xcc.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xche.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xdelta.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xdon.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xhk.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xich.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xmas.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xpv.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xstr.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xvolume.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.x121.xvwap.helper.mq5"
|
||||
|
||||
//
|
||||
@@ -52,6 +54,8 @@ struct X121Inputs
|
||||
X121XDONInputs xdonInputs;
|
||||
X121X3MAInputs x3maInputs;
|
||||
X121XVWAPInputs xvwapInputs;
|
||||
X121XDELTAInputs xdeltaInputs;
|
||||
X121XVOLUMEInputs xvolumeInputs;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
@@ -79,6 +83,8 @@ struct X121Inputs
|
||||
xcheInputs.Clean();
|
||||
xdonInputs.Clean();
|
||||
xvwapInputs.Clean();
|
||||
xdeltaInputs.Clean();
|
||||
xvolumeInputs.Clean();
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
@@ -101,6 +107,8 @@ struct X121Inputs
|
||||
xdonInputs.Default();
|
||||
x3maInputs.Default();
|
||||
xvwapInputs.Default();
|
||||
xdeltaInputs.Default();
|
||||
xvolumeInputs.Default();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +133,9 @@ struct X121Inputs
|
||||
xstrInputs.IsValid() &&
|
||||
xcheInputs.IsValid() &&
|
||||
xdonInputs.IsValid() &&
|
||||
xvwapInputs.IsValid()
|
||||
xvwapInputs.IsValid() &&
|
||||
xdeltaInputs.IsValid() &&
|
||||
xvolumeInputs.IsValid()
|
||||
//
|
||||
;
|
||||
|
||||
@@ -153,6 +163,8 @@ struct X121Inputs
|
||||
int xdonMax = xdonInputs.Max();
|
||||
int xichMax = xichInputs.Max();
|
||||
int xvwapMax = xvwapInputs.Max();
|
||||
int xdeltaMax = xdeltaInputs.Max();
|
||||
int xvolumeMax = xvolumeInputs.Max();
|
||||
|
||||
//
|
||||
result = MathMax(xpvMax, xhkMax);
|
||||
@@ -163,6 +175,8 @@ struct X121Inputs
|
||||
result = MathMax(result, xdonMax);
|
||||
result = MathMax(result, xichMax);
|
||||
result = MathMax(result, xvwapMax);
|
||||
result = MathMax(result, xdeltaMax);
|
||||
result = MathMax(result, xvolumeMax);
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -209,7 +223,9 @@ struct X121Conditions
|
||||
double valesBuffer[];
|
||||
double strUpBuffer[];
|
||||
double downTBuffer[];
|
||||
double deltaBuffer[];
|
||||
double masMidBuffer[];
|
||||
double deltaMaBuffer[];
|
||||
double strDownBuffer[];
|
||||
double vwapMidBuffer[];
|
||||
double upTrendBuffer[];
|
||||
@@ -237,6 +253,7 @@ struct X121Conditions
|
||||
double xhkRawLowBuffer[];
|
||||
double xhkSMOpenBuffer[];
|
||||
double xhkSMHighBuffer[];
|
||||
double deltaStateBuffer[];
|
||||
double xhkRawOpenBuffer[];
|
||||
double xhkRawHighBuffer[];
|
||||
double xhkSMCloseBuffer[];
|
||||
@@ -258,6 +275,8 @@ struct X121Conditions
|
||||
double donHighUpperBuffer[];
|
||||
double donHighLowerBuffer[];
|
||||
double x3maMidStateBuffer[];
|
||||
double bullishVolumeBuffer[];
|
||||
double bearishVolumeBuffer[];
|
||||
double fractalsUpperBuffer[];
|
||||
double fractalsLowerBuffer[];
|
||||
double vwapFastStateBuffer[];
|
||||
@@ -266,6 +285,8 @@ struct X121Conditions
|
||||
double donCloseLowerBuffer[];
|
||||
double x3maFastStateBuffer[];
|
||||
double x3maSlowStateBuffer[];
|
||||
double bullishVolumeMaBuffer[];
|
||||
double bearishVolumeMaBuffer[];
|
||||
|
||||
//
|
||||
double rsiSlope;
|
||||
@@ -575,12 +596,14 @@ struct X121Conditions
|
||||
Clean(valesBuffer);
|
||||
Clean(strUpBuffer);
|
||||
Clean(downTBuffer);
|
||||
Clean(deltaBuffer);
|
||||
Clean(volumeBuffer);
|
||||
Clean(masMidBuffer);
|
||||
Clean(strDownBuffer);
|
||||
Clean(vwapMidBuffer);
|
||||
Clean(upTrendBuffer);
|
||||
Clean(x3maMidBuffer);
|
||||
Clean(deltaMaBuffer);
|
||||
Clean(masUpperBuffer);
|
||||
Clean(masLowerBuffer);
|
||||
Clean(le1StartBuffer);
|
||||
@@ -609,6 +632,7 @@ struct X121Conditions
|
||||
Clean(xhkRawHighBuffer);
|
||||
Clean(xhkSMCloseBuffer);
|
||||
Clean(vwapVolumeBuffer);
|
||||
Clean(deltaStateBuffer);
|
||||
Clean(senkouSpanABuffer);
|
||||
Clean(senkouSpanBBuffer);
|
||||
Clean(peaksGoldenBuffer);
|
||||
@@ -625,6 +649,8 @@ struct X121Conditions
|
||||
Clean(donHighUpperBuffer);
|
||||
Clean(donHighLowerBuffer);
|
||||
Clean(x3maMidStateBuffer);
|
||||
Clean(bullishVolumeBuffer);
|
||||
Clean(bearishVolumeBuffer);
|
||||
Clean(fractalsUpperBuffer);
|
||||
Clean(fractalsLowerBuffer);
|
||||
Clean(vwapFastStateBuffer);
|
||||
@@ -633,6 +659,9 @@ struct X121Conditions
|
||||
Clean(donCloseLowerBuffer);
|
||||
Clean(x3maFastStateBuffer);
|
||||
Clean(x3maSlowStateBuffer);
|
||||
Clean(bullishVolumeMaBuffer);
|
||||
Clean(bearishVolumeMaBuffer);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(maBuffer, true);
|
||||
ArraySetAsSeries(rsiBuffer, true);
|
||||
@@ -661,8 +690,10 @@ struct X121Conditions
|
||||
ArraySetAsSeries(valesBuffer, true);
|
||||
ArraySetAsSeries(strUpBuffer, true);
|
||||
ArraySetAsSeries(downTBuffer, true);
|
||||
ArraySetAsSeries(deltaBuffer, true);
|
||||
ArraySetAsSeries(volumeBuffer, true);
|
||||
ArraySetAsSeries(masMidBuffer, true);
|
||||
ArraySetAsSeries(deltaMaBuffer, true);
|
||||
ArraySetAsSeries(strDownBuffer, true);
|
||||
ArraySetAsSeries(vwapMidBuffer, true);
|
||||
ArraySetAsSeries(upTrendBuffer, true);
|
||||
@@ -690,6 +721,7 @@ struct X121Conditions
|
||||
ArraySetAsSeries(xhkRawLowBuffer, true);
|
||||
ArraySetAsSeries(xhkSMOpenBuffer, true);
|
||||
ArraySetAsSeries(xhkSMHighBuffer, true);
|
||||
ArraySetAsSeries(deltaStateBuffer, true);
|
||||
ArraySetAsSeries(chikouSpanBuffer, true);
|
||||
ArraySetAsSeries(xhkRawOpenBuffer, true);
|
||||
ArraySetAsSeries(xhkRawHighBuffer, true);
|
||||
@@ -711,6 +743,8 @@ struct X121Conditions
|
||||
ArraySetAsSeries(donHighUpperBuffer, true);
|
||||
ArraySetAsSeries(donHighLowerBuffer, true);
|
||||
ArraySetAsSeries(x3maMidStateBuffer, true);
|
||||
ArraySetAsSeries(bullishVolumeBuffer, true);
|
||||
ArraySetAsSeries(bearishVolumeBuffer, true);
|
||||
ArraySetAsSeries(fractalsUpperBuffer, true);
|
||||
ArraySetAsSeries(fractalsLowerBuffer, true);
|
||||
ArraySetAsSeries(vwapFastStateBuffer, true);
|
||||
@@ -719,6 +753,8 @@ struct X121Conditions
|
||||
ArraySetAsSeries(donCloseLowerBuffer, true);
|
||||
ArraySetAsSeries(x3maFastStateBuffer, true);
|
||||
ArraySetAsSeries(x3maSlowStateBuffer, true);
|
||||
ArraySetAsSeries(bullishVolumeMaBuffer, true);
|
||||
ArraySetAsSeries(bearishVolumeMaBuffer, true);
|
||||
|
||||
//
|
||||
cheMin = 0;
|
||||
@@ -2132,6 +2168,8 @@ class XCX121Helper : public XCBase
|
||||
XCX121XDONHelper *xdonHelper;
|
||||
XCX121X3MAHelper *x3maHelper;
|
||||
XCX121XVWAPHelper *xvwapHelper;
|
||||
XCX121XDELTAHelper *xdeltaHelper;
|
||||
XCX121XVOLUMEHelper *xvolumeHelper;
|
||||
|
||||
//
|
||||
// Constructors ...
|
||||
@@ -2156,6 +2194,8 @@ class XCX121Helper : public XCBase
|
||||
xcheInputs.Clean();
|
||||
x3maInputs.Clean();
|
||||
xvwapInputs.Clean();
|
||||
xdeltaInputs.Clean();
|
||||
xvolumeInputs.Clean();
|
||||
|
||||
//
|
||||
delete xccHelper;
|
||||
@@ -2169,6 +2209,8 @@ class XCX121Helper : public XCBase
|
||||
delete xdonHelper;
|
||||
delete x3maHelper;
|
||||
delete xvwapHelper;
|
||||
delete xdeltaHelper;
|
||||
delete xvolumeHelper;
|
||||
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
@@ -2182,6 +2224,8 @@ class XCX121Helper : public XCBase
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2247,6 +2291,8 @@ class XCX121Helper : public XCBase
|
||||
xdonInputs = inputs.xdonInputs;
|
||||
x3maInputs = inputs.x3maInputs;
|
||||
xvwapInputs = inputs.xvwapInputs;
|
||||
xdeltaInputs = inputs.xdeltaInputs;
|
||||
xvolumeInputs = inputs.xvolumeInputs;
|
||||
|
||||
//
|
||||
// Initial Helpers ...
|
||||
@@ -2261,6 +2307,22 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2274,6 +2336,22 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2287,6 +2365,22 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2300,6 +2394,22 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2313,6 +2423,22 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2326,6 +2452,22 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2339,6 +2481,22 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2352,6 +2510,22 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2365,6 +2539,22 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2378,6 +2568,22 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2391,6 +2597,80 @@ class XCX121Helper : public XCBase
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XDELTA ...
|
||||
xdeltaHelper = new XCX121XDELTAHelper();
|
||||
result = xdeltaHelper.Init(
|
||||
symbol,
|
||||
period,
|
||||
xdeltaInputs //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XVOLUME ...
|
||||
xvolumeHelper = new XCX121XVOLUMEHelper();
|
||||
result = xvolumeHelper.Init(
|
||||
symbol,
|
||||
period,
|
||||
xvolumeInputs //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2409,6 +2689,22 @@ class XCX121Helper : public XCBase
|
||||
result = mRSIHandler != INVALID_HANDLE;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(xccHelper);
|
||||
ZeroMemory(xpvHelper);
|
||||
ZeroMemory(xhkHelper);
|
||||
ZeroMemory(xmasHelper);
|
||||
ZeroMemory(xatrHelper);
|
||||
ZeroMemory(xichHelper);
|
||||
ZeroMemory(xstrHelper);
|
||||
ZeroMemory(xcheHelper);
|
||||
ZeroMemory(xdonHelper);
|
||||
ZeroMemory(x3maHelper);
|
||||
ZeroMemory(xvwapHelper);
|
||||
ZeroMemory(xdeltaHelper);
|
||||
ZeroMemory(xvolumeHelper);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -2640,6 +2936,50 @@ class XCX121Helper : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XDELTA ...
|
||||
bool GetDELTAConditions(
|
||||
X121XDELTAConditions &conditions, //
|
||||
int barIndex = 0, //
|
||||
int loopback = 5 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = xdeltaHelper.GetConditions(
|
||||
conditions,
|
||||
barIndex,
|
||||
loopback //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XVOLUME ...
|
||||
bool GetVOLUMEConditions(
|
||||
X121XVOLUMEConditions &conditions, //
|
||||
int barIndex = 0, //
|
||||
int loopback = 5 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = xvolumeHelper.GetConditions(
|
||||
conditions,
|
||||
barIndex,
|
||||
loopback //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
void Free()
|
||||
{
|
||||
@@ -2936,6 +3276,61 @@ class XCX121Helper : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XDELTA ...
|
||||
X121XDELTAConditions xdeltaConditions;
|
||||
result = GetDELTAConditions(
|
||||
xdeltaConditions,
|
||||
barIndex,
|
||||
loopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
xpvConditions.Clean();
|
||||
xhkConditions.Clean();
|
||||
xichConditions.Clean();
|
||||
xmasConditions.Clean();
|
||||
xatrConditions.Clean();
|
||||
xstrConditions.Clean();
|
||||
xcheConditions.Clean();
|
||||
xdonConditions.Clean();
|
||||
x3maConditions.Clean();
|
||||
xvwapConditions.Clean();
|
||||
xdeltaConditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// XVOLUME ...
|
||||
X121XVOLUMEConditions xvolumeConditions;
|
||||
result = GetVOLUMEConditions(
|
||||
xvolumeConditions,
|
||||
barIndex,
|
||||
loopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
xpvConditions.Clean();
|
||||
xhkConditions.Clean();
|
||||
xichConditions.Clean();
|
||||
xmasConditions.Clean();
|
||||
xatrConditions.Clean();
|
||||
xstrConditions.Clean();
|
||||
xcheConditions.Clean();
|
||||
xdonConditions.Clean();
|
||||
x3maConditions.Clean();
|
||||
xvwapConditions.Clean();
|
||||
xdeltaConditions.Clean();
|
||||
xvolumeConditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Fill Volume Buffer ...
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
@@ -3639,6 +4034,66 @@ class XCX121Helper : public XCBase
|
||||
conditions.senkouMax = MathMax(xichConditions.senkouSpanABuffer[cIDX], xichConditions.senkouSpanBBuffer[cIDX]);
|
||||
conditions.senkouMin = MathMin(xichConditions.senkouSpanABuffer[cIDX], xichConditions.senkouSpanBBuffer[cIDX]);
|
||||
|
||||
//
|
||||
// XDELTA ...
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
//
|
||||
Copy(
|
||||
xdeltaConditions.deltaBuffer,
|
||||
conditions.deltaBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
xdeltaConditions.deltaMaBuffer,
|
||||
conditions.deltaMaBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
xdeltaConditions.deltaStateBuffer,
|
||||
conditions.deltaStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
// XVOLUME ...
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
//
|
||||
Copy(
|
||||
xvolumeConditions.bullishVolumeBuffer,
|
||||
conditions.bullishVolumeBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
xvolumeConditions.bullishVolumeMaBuffer,
|
||||
conditions.bullishVolumeMaBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
xvolumeConditions.bearishVolumeBuffer,
|
||||
conditions.bearishVolumeBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
xvolumeConditions.bearishVolumeMaBuffer,
|
||||
conditions.bearishVolumeMaBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
// Slopes ...
|
||||
|
||||
@@ -4152,6 +4607,8 @@ class XCX121Helper : public XCBase
|
||||
X121XCHEInputs xcheInputs;
|
||||
X121X3MAInputs x3maInputs;
|
||||
X121XVWAPInputs xvwapInputs;
|
||||
X121XDELTAInputs xdeltaInputs;
|
||||
X121XVOLUMEInputs xvolumeInputs;
|
||||
|
||||
//
|
||||
int mRSIHandler;
|
||||
|
||||
@@ -0,0 +1,780 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Helper Class Library
|
||||
// ----------------------------------------------
|
||||
// Name: XCX121XDELTASHelper
|
||||
// Description: provides all Indicator
|
||||
// Helper requirements ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../Classes/x-saherelm.x-helper.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
enum ENUM_X121_XDELTA_BUFFERS
|
||||
{
|
||||
//
|
||||
X121_XDELTA_VOLUME_LINE = 0,
|
||||
X121_XDELTA_HISTOGRAM_LINE = 1,
|
||||
X121_XDELTA_MA_LINE = 3,
|
||||
X121_XDELTA_STATE_LINE = 5,
|
||||
};
|
||||
|
||||
//
|
||||
// Input Models ...
|
||||
struct X121XDELTAInputs
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Makret ...
|
||||
int maLength; // Moving Averge Length
|
||||
ENUM_X_MA_METHOD maMethod; // Moving Averge Method
|
||||
|
||||
//
|
||||
// Presentation ...
|
||||
int startCalculationForLastBars; // Calculate Last n Bars
|
||||
bool showDeltaLine; // Show Delta Line
|
||||
bool showDeltaHistogram; // Show Delta Histogram
|
||||
bool showDeltaMa; // Show Delta Moving Average
|
||||
|
||||
//
|
||||
// Constructor(s) ...
|
||||
X121XDELTAInputs()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleanup Model ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
// Makret ...
|
||||
maLength = 0; // Moving Averge Length
|
||||
maMethod = X_MA_MODE_NONE; // Moving Averge Method
|
||||
|
||||
//
|
||||
// Presentation ...
|
||||
startCalculationForLastBars = 0; // Calculate Last n Bars
|
||||
showDeltaLine = false; // Show Delta Line
|
||||
showDeltaHistogram = false; // Show Delta Histogram
|
||||
showDeltaMa = false; // Show Delta Moving Average
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Inputs ...
|
||||
*/
|
||||
void Default()
|
||||
{
|
||||
//
|
||||
// Makret ...
|
||||
maLength = 14; // Moving Averge Length
|
||||
maMethod = X_MA_MODE_EMA; // Moving Averge Method
|
||||
|
||||
//
|
||||
// Presentation ...
|
||||
startCalculationForLastBars = 1000; // Calculate Last n Bars
|
||||
showDeltaLine = true; // Show Delta Line
|
||||
showDeltaHistogram = true; // Show Delta Histogram
|
||||
showDeltaMa = true; // Show Delta Moving Average
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Model ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsValid()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
maLength > 0 &&
|
||||
IsValid(maMethod)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Max Input Length ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int Max()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
result = MathMax(result, maLength);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
struct X121XDELTAConditions
|
||||
{
|
||||
//
|
||||
// Common ...
|
||||
string symbol;
|
||||
ENUM_TIMEFRAMES period;
|
||||
datetime time;
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
double deltaBuffer[];
|
||||
double deltaMaBuffer[];
|
||||
double deltaStateBuffer[];
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
X121XDELTAConditions()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleaning Up ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
// Commons ...
|
||||
time = NULL;
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
//
|
||||
Clean(deltaBuffer);
|
||||
Clean(deltaMaBuffer);
|
||||
Clean(deltaStateBuffer);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(deltaBuffer, true);
|
||||
ArraySetAsSeries(deltaMaBuffer, true);
|
||||
ArraySetAsSeries(deltaStateBuffer, true);
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Conditions Scores ...
|
||||
*
|
||||
* @param bullishScore: Double, Directional Scores Reference ...
|
||||
* @param bearishScore: Double, Directional Scores Reference ...
|
||||
*/
|
||||
void GenerateScore(
|
||||
double &bullishScore,
|
||||
double &bearishScore //
|
||||
)
|
||||
{
|
||||
//
|
||||
bullishScore = 0;
|
||||
bearishScore = 0;
|
||||
|
||||
//
|
||||
// TODO: Implement if Required ...
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Summary String for Represent Conditions State ...
|
||||
*
|
||||
* @param onlyCommons: Boolean, Just Generate Only Commons Conditions ...
|
||||
* @param onlyConditions: Boolean, Just Generate Only Conditions ...
|
||||
* @param includeScores: Boolean, Attach Scores Representations on Result ...
|
||||
* @param ignoreFalseConditions: Boolean, Ignore False Conditions on Result ...
|
||||
* @param separator: String, Separate Lines ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string GenerateSummary(
|
||||
bool onlyCommons = false,
|
||||
bool onlyConditions = false,
|
||||
bool includeScores = true,
|
||||
bool ignoreFalseConditions = true,
|
||||
string separator = "\n" //
|
||||
)
|
||||
{
|
||||
//
|
||||
string result = NULL;
|
||||
|
||||
//
|
||||
double bullishScore = 0;
|
||||
double bearishScore = 0;
|
||||
GenerateScore(
|
||||
bullishScore,
|
||||
bearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
string scoresStr =
|
||||
//
|
||||
"Scores: " + separator +
|
||||
"---------------" + separator +
|
||||
"Bullish: " + ToString(bullishScore) + separator +
|
||||
"Bearish: " + ToString(bearishScore) + separator +
|
||||
""
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
string commonStr = GenerateSpecifiedCommonSummary(
|
||||
this,
|
||||
separator,
|
||||
includeScores //
|
||||
);
|
||||
|
||||
//
|
||||
string conditionsStr =
|
||||
//
|
||||
//
|
||||
""
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
"[" + GetTag() + "]" + separator +
|
||||
(onlyConditions
|
||||
? ""
|
||||
: commonStr) +
|
||||
(!includeScores
|
||||
? ""
|
||||
: scoresStr) +
|
||||
" " + separator +
|
||||
(onlyCommons
|
||||
? ""
|
||||
: conditionsStr) +
|
||||
""
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve nique Tag Identifier ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string GetTag()
|
||||
{
|
||||
return GetTypeName(this);
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Class ...
|
||||
class XCX121XDELTAHelper : public XCBaseHelper
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Constructors ...
|
||||
XCX121XDELTAHelper()
|
||||
: XCBaseHelper(_Symbol, _Period)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
~XCX121XDELTAHelper()
|
||||
{
|
||||
//
|
||||
mInputs.Clean();
|
||||
|
||||
//
|
||||
Clean(deltaBuffer);
|
||||
Clean(deltaMaBuffer);
|
||||
Clean(deltaStateBuffer);
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
bool Init(
|
||||
string symbol, // Trading Symbol
|
||||
ENUM_TIMEFRAMES period, // Trading Period
|
||||
X121XDELTAInputs &inputs // Inputs
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
mSymbol = symbol;
|
||||
mPeriod = period;
|
||||
|
||||
//
|
||||
result = inputs.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ArraySetAsSeries(deltaBuffer, true);
|
||||
ArraySetAsSeries(deltaMaBuffer, true);
|
||||
ArraySetAsSeries(deltaStateBuffer, true);
|
||||
|
||||
//
|
||||
mInputs = inputs;
|
||||
|
||||
//
|
||||
mHandler = iCustom(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
"x-saherelm.x121.xdelta",
|
||||
//
|
||||
// Inputs ...
|
||||
//
|
||||
// Market ...
|
||||
"",
|
||||
mInputs.maLength,
|
||||
mInputs.maMethod,
|
||||
//
|
||||
// Presentation ...
|
||||
"",
|
||||
//
|
||||
mInputs.startCalculationForLastBars,
|
||||
mInputs.showDeltaLine,
|
||||
mInputs.showDeltaHistogram,
|
||||
mInputs.showDeltaMa
|
||||
//
|
||||
);
|
||||
result = mHandler != INVALID_HANDLE;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Inputs ...
|
||||
|
||||
//
|
||||
X121XDELTAInputs GetInputs()
|
||||
{
|
||||
return mInputs;
|
||||
}
|
||||
|
||||
//
|
||||
bool SetInputs(
|
||||
X121XDELTAInputs &inputs // Configs
|
||||
)
|
||||
{
|
||||
//
|
||||
return Init(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
inputs
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Readers ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
|
||||
//
|
||||
double GetDelta(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
int count = ArraySize(deltaBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return deltaBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyDelta(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate();
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
start,
|
||||
count,
|
||||
deltaBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double GetDeltaState(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
int count = ArraySize(deltaStateBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return deltaStateBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyDeltaState(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate();
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
start,
|
||||
count,
|
||||
deltaStateBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double GetDeltaMa(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
int count = ArraySize(deltaMaBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return deltaMaBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyDeltaMa(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate();
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
start,
|
||||
count,
|
||||
deltaMaBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
bool GetConditions(
|
||||
X121XDELTAConditions &conditions, //
|
||||
int barIndex = 0, //
|
||||
int loopback = 5 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = true;
|
||||
|
||||
//
|
||||
if (loopback < 5)
|
||||
{
|
||||
loopback = 5;
|
||||
}
|
||||
|
||||
//
|
||||
conditions.Clean();
|
||||
|
||||
//
|
||||
conditions.symbol = mSymbol;
|
||||
conditions.period = mPeriod;
|
||||
conditions.time = TimeCurrent();
|
||||
|
||||
//
|
||||
int zIndex = barIndex;
|
||||
int cIndex = zIndex + 1;
|
||||
int pIndex = cIndex + 1;
|
||||
int ppIndex = pIndex + 1;
|
||||
|
||||
//
|
||||
XOHCL zBar;
|
||||
result = zBar.Init(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
zIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
result = cBar.Init(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
cIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
result = pBar.Init(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
pIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
//
|
||||
CopyDelta(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.deltaBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyDeltaState(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.deltaStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyDeltaMa(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.deltaMaBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
int cIDX = 1;
|
||||
int pIDX = cIDX + 1;
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
|
||||
//
|
||||
Cleanup();
|
||||
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
X121XDELTAInputs mInputs; // Inputs ...
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
double deltaBuffer[];
|
||||
double deltaMaBuffer[];
|
||||
double deltaStateBuffer[];
|
||||
|
||||
//
|
||||
void Calculate(
|
||||
int maxRequiredBars = 100 //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XDELTA_VOLUME_LINE,
|
||||
0,
|
||||
maxRequiredBars,
|
||||
deltaBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XDELTA_MA_LINE,
|
||||
0,
|
||||
maxRequiredBars,
|
||||
deltaMaBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XDELTA_STATE_LINE,
|
||||
0,
|
||||
maxRequiredBars,
|
||||
deltaStateBuffer
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
void Cleanup(
|
||||
int maxAllowed = 100 //
|
||||
)
|
||||
{
|
||||
//
|
||||
CleanupArray(
|
||||
deltaBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
deltaMaBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
deltaStateBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
@@ -27,8 +27,6 @@
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
enum ENUM_X121_XMAS_BUFFERS
|
||||
{
|
||||
//
|
||||
|
||||
@@ -0,0 +1,865 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Helper Class Library
|
||||
// ----------------------------------------------
|
||||
// Name: XCX121XVOLUMESHelper
|
||||
// Description: provides all Indicator
|
||||
// Helper requirements ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../Classes/x-saherelm.x-helper.class.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
enum ENUM_X121_XVOLUME_BUFFERS
|
||||
{
|
||||
//
|
||||
X121_XVOLUME_BULLISH_LINE = 0,
|
||||
X121_XVOLUME_BULLISH_MA_LINE = 1,
|
||||
X121_XVOLUME_BEARISH_LINE = 2,
|
||||
X121_XVOLUME_BEARISH_MA_LINE = 3,
|
||||
};
|
||||
|
||||
//
|
||||
// Input Models ...
|
||||
struct X121XVOLUMEInputs
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Makret ...
|
||||
int maLength; // Moving Averge Length
|
||||
ENUM_X_MA_METHOD maMethod; // Moving Averge Method
|
||||
|
||||
//
|
||||
// Presentation ...
|
||||
int startCalculationForLastBars; // Calculate Last n Bars
|
||||
bool showBullishVolume; // Show Bullish Volume
|
||||
bool showBullishVolumeMa; // Show Bullish Volume Moving Average
|
||||
bool showBearishVolume; // Show Bearish Volume
|
||||
bool showBearishVolumeMa; // Show Bearish Volume Moving Average
|
||||
|
||||
//
|
||||
// Constructor(s) ...
|
||||
X121XVOLUMEInputs()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleanup Model ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
// Makret ...
|
||||
maLength = 0; // Moving Averge Length
|
||||
maMethod = X_MA_MODE_NONE; // Moving Averge Method
|
||||
|
||||
//
|
||||
// Presentation ...
|
||||
startCalculationForLastBars = 0; // Calculate Last n Bars
|
||||
showBullishVolume = false; // Show Bullish Volume
|
||||
showBullishVolumeMa = false; // Show Bullish Volume Moving Average
|
||||
showBearishVolume = false; // Show Bearish Volume
|
||||
showBearishVolumeMa = false; // Show Bearish Volume Moving Average
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Inputs ...
|
||||
*/
|
||||
void Default()
|
||||
{
|
||||
//
|
||||
// Makret ...
|
||||
maLength = 14; // Moving Averge Length
|
||||
maMethod = X_MA_MODE_EMA; // Moving Averge Method
|
||||
|
||||
//
|
||||
// Presentation ...
|
||||
startCalculationForLastBars = 1000; // Calculate Last n Bars
|
||||
showBullishVolume = true; // Show Bullish Volume
|
||||
showBullishVolumeMa = true; // Show Bullish Volume Moving Average
|
||||
showBearishVolume = true; // Show Bearish Volume
|
||||
showBearishVolumeMa = true; // Show Bearish Volume Moving Average
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Model ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsValid()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
maLength > 0 &&
|
||||
IsValid(maMethod)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Max Input Length ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int Max()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
result = MathMax(result, maLength);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
struct X121XVOLUMEConditions
|
||||
{
|
||||
//
|
||||
// Common ...
|
||||
string symbol;
|
||||
ENUM_TIMEFRAMES period;
|
||||
datetime time;
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
double bullishVolumeBuffer[];
|
||||
double bullishVolumeMaBuffer[];
|
||||
double bearishVolumeBuffer[];
|
||||
double bearishVolumeMaBuffer[];
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
X121XVOLUMEConditions()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleaning Up ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
// Commons ...
|
||||
time = NULL;
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
//
|
||||
Clean(bullishVolumeBuffer);
|
||||
Clean(bullishVolumeMaBuffer);
|
||||
Clean(bearishVolumeBuffer);
|
||||
Clean(bearishVolumeMaBuffer);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(bullishVolumeBuffer, true);
|
||||
ArraySetAsSeries(bullishVolumeMaBuffer, true);
|
||||
ArraySetAsSeries(bearishVolumeBuffer, true);
|
||||
ArraySetAsSeries(bearishVolumeMaBuffer, true);
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Conditions Scores ...
|
||||
*
|
||||
* @param bullishScore: Double, Directional Scores Reference ...
|
||||
* @param bearishScore: Double, Directional Scores Reference ...
|
||||
*/
|
||||
void GenerateScore(
|
||||
double &bullishScore,
|
||||
double &bearishScore //
|
||||
)
|
||||
{
|
||||
//
|
||||
bullishScore = 0;
|
||||
bearishScore = 0;
|
||||
|
||||
//
|
||||
// TODO: Implement if Required ...
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Summary String for Represent Conditions State ...
|
||||
*
|
||||
* @param onlyCommons: Boolean, Just Generate Only Commons Conditions ...
|
||||
* @param onlyConditions: Boolean, Just Generate Only Conditions ...
|
||||
* @param includeScores: Boolean, Attach Scores Representations on Result ...
|
||||
* @param ignoreFalseConditions: Boolean, Ignore False Conditions on Result ...
|
||||
* @param separator: String, Separate Lines ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string GenerateSummary(
|
||||
bool onlyCommons = false,
|
||||
bool onlyConditions = false,
|
||||
bool includeScores = true,
|
||||
bool ignoreFalseConditions = true,
|
||||
string separator = "\n" //
|
||||
)
|
||||
{
|
||||
//
|
||||
string result = NULL;
|
||||
|
||||
//
|
||||
double bullishScore = 0;
|
||||
double bearishScore = 0;
|
||||
GenerateScore(
|
||||
bullishScore,
|
||||
bearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
string scoresStr =
|
||||
//
|
||||
"Scores: " + separator +
|
||||
"---------------" + separator +
|
||||
"Bullish: " + ToString(bullishScore) + separator +
|
||||
"Bearish: " + ToString(bearishScore) + separator +
|
||||
""
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
string commonStr = GenerateSpecifiedCommonSummary(
|
||||
this,
|
||||
separator,
|
||||
includeScores //
|
||||
);
|
||||
|
||||
//
|
||||
string conditionsStr =
|
||||
//
|
||||
//
|
||||
""
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
"[" + GetTag() + "]" + separator +
|
||||
(onlyConditions
|
||||
? ""
|
||||
: commonStr) +
|
||||
(!includeScores
|
||||
? ""
|
||||
: scoresStr) +
|
||||
" " + separator +
|
||||
(onlyCommons
|
||||
? ""
|
||||
: conditionsStr) +
|
||||
""
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve nique Tag Identifier ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string GetTag()
|
||||
{
|
||||
return GetTypeName(this);
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Class ...
|
||||
class XCX121XVOLUMEHelper : public XCBaseHelper
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Constructors ...
|
||||
XCX121XVOLUMEHelper()
|
||||
: XCBaseHelper(_Symbol, _Period)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
~XCX121XVOLUMEHelper()
|
||||
{
|
||||
//
|
||||
mInputs.Clean();
|
||||
|
||||
//
|
||||
Clean(bullishVolumeBuffer);
|
||||
Clean(bullishVolumeMaBuffer);
|
||||
Clean(bearishVolumeBuffer);
|
||||
Clean(bearishVolumeMaBuffer);
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
bool Init(
|
||||
string symbol, // Trading Symbol
|
||||
ENUM_TIMEFRAMES period, // Trading Period
|
||||
X121XVOLUMEInputs &inputs // Inputs
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
mSymbol = symbol;
|
||||
mPeriod = period;
|
||||
|
||||
//
|
||||
result = inputs.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ArraySetAsSeries(bullishVolumeBuffer, true);
|
||||
ArraySetAsSeries(bullishVolumeMaBuffer, true);
|
||||
ArraySetAsSeries(bearishVolumeBuffer, true);
|
||||
ArraySetAsSeries(bearishVolumeMaBuffer, true);
|
||||
|
||||
//
|
||||
mInputs = inputs;
|
||||
|
||||
//
|
||||
mHandler = iCustom(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
"x-saherelm.x121.xvolume",
|
||||
//
|
||||
// Inputs ...
|
||||
//
|
||||
// Market ...
|
||||
"",
|
||||
mInputs.maLength,
|
||||
mInputs.maMethod,
|
||||
//
|
||||
// Presentation ...
|
||||
"",
|
||||
//
|
||||
mInputs.startCalculationForLastBars,
|
||||
mInputs.showBullishVolume,
|
||||
mInputs.showBullishVolumeMa,
|
||||
mInputs.showBearishVolume,
|
||||
mInputs.showBearishVolumeMa
|
||||
//
|
||||
);
|
||||
result = mHandler != INVALID_HANDLE;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Inputs ...
|
||||
|
||||
//
|
||||
X121XVOLUMEInputs GetInputs()
|
||||
{
|
||||
return mInputs;
|
||||
}
|
||||
|
||||
//
|
||||
bool SetInputs(
|
||||
X121XVOLUMEInputs &inputs // Configs
|
||||
)
|
||||
{
|
||||
//
|
||||
return Init(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
inputs
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Readers ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
|
||||
//
|
||||
double GetBullishVolume(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
int count = ArraySize(bullishVolumeBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return bullishVolumeBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyBullishVolume(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate();
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
start,
|
||||
count,
|
||||
bullishVolumeBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double GetBullishVolumeMa(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
int count = ArraySize(bullishVolumeMaBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return bullishVolumeMaBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyBullishVolumeMa(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate();
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
start,
|
||||
count,
|
||||
bullishVolumeMaBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
|
||||
//
|
||||
double GetBearishVolume(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
int count = ArraySize(bearishVolumeBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return bearishVolumeBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyBearishVolume(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate();
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
start,
|
||||
count,
|
||||
bearishVolumeBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double GetBearishVolumeMa(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate();
|
||||
|
||||
//
|
||||
int count = ArraySize(bearishVolumeMaBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return bearishVolumeMaBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopyBearishVolumeMa(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate();
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
start,
|
||||
count,
|
||||
bearishVolumeMaBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
bool GetConditions(
|
||||
X121XVOLUMEConditions &conditions, //
|
||||
int barIndex = 0, //
|
||||
int loopback = 5 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = true;
|
||||
|
||||
//
|
||||
if (loopback < 5)
|
||||
{
|
||||
loopback = 5;
|
||||
}
|
||||
|
||||
//
|
||||
conditions.Clean();
|
||||
|
||||
//
|
||||
conditions.symbol = mSymbol;
|
||||
conditions.period = mPeriod;
|
||||
conditions.time = TimeCurrent();
|
||||
|
||||
//
|
||||
int zIndex = barIndex;
|
||||
int cIndex = zIndex + 1;
|
||||
int pIndex = cIndex + 1;
|
||||
int ppIndex = pIndex + 1;
|
||||
|
||||
//
|
||||
XOHCL zBar;
|
||||
result = zBar.Init(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
zIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
result = cBar.Init(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
cIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
result = pBar.Init(
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
pIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
//
|
||||
CopyBullishVolume(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.bullishVolumeBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBullishVolumeMa(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.bullishVolumeMaBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBearishVolume(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.bearishVolumeBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopyBearishVolumeMa(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.bearishVolumeMaBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
int cIDX = 1;
|
||||
int pIDX = cIDX + 1;
|
||||
|
||||
//
|
||||
// SAR ...
|
||||
|
||||
//
|
||||
Cleanup();
|
||||
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
X121XVOLUMEInputs mInputs; // Inputs ...
|
||||
|
||||
//
|
||||
// Buffers ...
|
||||
double bullishVolumeBuffer[];
|
||||
double bullishVolumeMaBuffer[];
|
||||
double bearishVolumeBuffer[];
|
||||
double bearishVolumeMaBuffer[];
|
||||
|
||||
//
|
||||
void Calculate(
|
||||
int maxRequiredBars = 100 //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XVOLUME_BULLISH_LINE,
|
||||
0,
|
||||
maxRequiredBars,
|
||||
bullishVolumeBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XVOLUME_BULLISH_MA_LINE,
|
||||
0,
|
||||
maxRequiredBars,
|
||||
bullishVolumeMaBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XVOLUME_BEARISH_LINE,
|
||||
0,
|
||||
maxRequiredBars,
|
||||
bearishVolumeBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XVOLUME_BEARISH_MA_LINE,
|
||||
0,
|
||||
maxRequiredBars,
|
||||
bearishVolumeMaBuffer
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
void Cleanup(
|
||||
int maxAllowed = 100 //
|
||||
)
|
||||
{
|
||||
//
|
||||
CleanupArray(
|
||||
bullishVolumeBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
bullishVolumeMaBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
bearishVolumeBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
bearishVolumeMaBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user