add support for xtrend indicator in x121 setup helper ...
This commit is contained in:
@@ -23,13 +23,12 @@
|
|||||||
//
|
//
|
||||||
// Imports ...
|
// Imports ...
|
||||||
#include "../Helpers/x-saherelm.x121.xatr.helper.mq5"
|
#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.xche.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.x121.xct.helper.mq5"
|
|
||||||
#include "../Helpers/x-saherelm.x121.xdon.helper.mq5"
|
#include "../Helpers/x-saherelm.x121.xdon.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.x121.xhk.helper.mq5"
|
#include "../Helpers/x-saherelm.x121.xhk.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.x121.xpv.helper.mq5"
|
#include "../Helpers/x-saherelm.x121.xpv.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.x121.xstr.helper.mq5"
|
#include "../Helpers/x-saherelm.x121.xstr.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.x121.xtrend.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.x121.xvwap.helper.mq5"
|
#include "../Helpers/x-saherelm.x121.xvwap.helper.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -39,8 +38,6 @@ struct X121Inputs
|
|||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
bool showRSI;
|
bool showRSI;
|
||||||
X121XCCInputs xccInputs;
|
|
||||||
X121XCTInputs xctInputs;
|
|
||||||
X121XPVInputs xpvInputs;
|
X121XPVInputs xpvInputs;
|
||||||
X121XHKInputs xhkInputs;
|
X121XHKInputs xhkInputs;
|
||||||
X121XATRInputs xatrInputs;
|
X121XATRInputs xatrInputs;
|
||||||
@@ -48,6 +45,7 @@ struct X121Inputs
|
|||||||
X121XCHEInputs xcheInputs;
|
X121XCHEInputs xcheInputs;
|
||||||
X121XDONInputs xdonInputs;
|
X121XDONInputs xdonInputs;
|
||||||
X121XVWAPInputs xvwapInputs;
|
X121XVWAPInputs xvwapInputs;
|
||||||
|
X121XTRENDInputs xtrendInputs;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
@@ -65,8 +63,6 @@ struct X121Inputs
|
|||||||
void Clean()
|
void Clean()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
xccInputs.Clean();
|
|
||||||
xctInputs.Clean();
|
|
||||||
xpvInputs.Clean();
|
xpvInputs.Clean();
|
||||||
xhkInputs.Clean();
|
xhkInputs.Clean();
|
||||||
xatrInputs.Clean();
|
xatrInputs.Clean();
|
||||||
@@ -74,6 +70,7 @@ struct X121Inputs
|
|||||||
xcheInputs.Clean();
|
xcheInputs.Clean();
|
||||||
xdonInputs.Clean();
|
xdonInputs.Clean();
|
||||||
xvwapInputs.Clean();
|
xvwapInputs.Clean();
|
||||||
|
xtrendInputs.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
ZeroMemory(this);
|
ZeroMemory(this);
|
||||||
@@ -85,8 +82,6 @@ struct X121Inputs
|
|||||||
void Default()
|
void Default()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
xccInputs.Default();
|
|
||||||
xctInputs.Default();
|
|
||||||
xpvInputs.Default();
|
xpvInputs.Default();
|
||||||
xhkInputs.Default();
|
xhkInputs.Default();
|
||||||
xatrInputs.Default();
|
xatrInputs.Default();
|
||||||
@@ -94,6 +89,7 @@ struct X121Inputs
|
|||||||
xcheInputs.Default();
|
xcheInputs.Default();
|
||||||
xdonInputs.Default();
|
xdonInputs.Default();
|
||||||
xvwapInputs.Default();
|
xvwapInputs.Default();
|
||||||
|
xtrendInputs.Default();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,15 +105,14 @@ struct X121Inputs
|
|||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
xccInputs.IsValid() &&
|
|
||||||
xctInputs.IsValid() &&
|
|
||||||
xpvInputs.IsValid() &&
|
xpvInputs.IsValid() &&
|
||||||
xhkInputs.IsValid() &&
|
xhkInputs.IsValid() &&
|
||||||
xatrInputs.IsValid() &&
|
xatrInputs.IsValid() &&
|
||||||
xstrInputs.IsValid() &&
|
xstrInputs.IsValid() &&
|
||||||
xcheInputs.IsValid() &&
|
xcheInputs.IsValid() &&
|
||||||
xdonInputs.IsValid() &&
|
xdonInputs.IsValid() &&
|
||||||
xvwapInputs.IsValid()
|
xvwapInputs.IsValid() &&
|
||||||
|
xtrendInputs.IsValid()
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -136,8 +131,6 @@ struct X121Inputs
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
int xccMax = xccInputs.Max();
|
|
||||||
int xctMax = xctInputs.Max();
|
|
||||||
int xpvMax = xpvInputs.Max();
|
int xpvMax = xpvInputs.Max();
|
||||||
int xhkMax = xpvInputs.Max();
|
int xhkMax = xpvInputs.Max();
|
||||||
int xatrMax = xatrInputs.Max();
|
int xatrMax = xatrInputs.Max();
|
||||||
@@ -145,15 +138,16 @@ struct X121Inputs
|
|||||||
int xcheMax = xcheInputs.Max();
|
int xcheMax = xcheInputs.Max();
|
||||||
int xdonMax = xdonInputs.Max();
|
int xdonMax = xdonInputs.Max();
|
||||||
int xvwapMax = xvwapInputs.Max();
|
int xvwapMax = xvwapInputs.Max();
|
||||||
|
int xtrendMax = xtrendInputs.Max();
|
||||||
|
|
||||||
//
|
//
|
||||||
result = MathMax(xccMax, xctMax);
|
result = MathMax(xpvMax, xhkMax);
|
||||||
result = MathMax(result, xpvMax);
|
|
||||||
result = MathMax(result, xatrMax);
|
result = MathMax(result, xatrMax);
|
||||||
result = MathMax(result, xstrMax);
|
result = MathMax(result, xstrMax);
|
||||||
result = MathMax(result, xcheMax);
|
result = MathMax(result, xcheMax);
|
||||||
result = MathMax(result, xdonMax);
|
result = MathMax(result, xdonMax);
|
||||||
result = MathMax(result, xvwapMax);
|
result = MathMax(result, xvwapMax);
|
||||||
|
result = MathMax(result, xtrendMax);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -172,6 +166,7 @@ struct X121Conditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
|
double maBuffer[];
|
||||||
double rsiBuffer[];
|
double rsiBuffer[];
|
||||||
double atrBuffer[];
|
double atrBuffer[];
|
||||||
double strBuffer[];
|
double strBuffer[];
|
||||||
@@ -190,12 +185,18 @@ struct X121Conditions
|
|||||||
double lLLBuffer[];
|
double lLLBuffer[];
|
||||||
double hHHBuffer[];
|
double hHHBuffer[];
|
||||||
double hLLBuffer[];
|
double hLLBuffer[];
|
||||||
|
double upTBuffer[];
|
||||||
|
double adxBuffer[];
|
||||||
|
double adxPBuffer[];
|
||||||
|
double adxMBuffer[];
|
||||||
long volumeBuffer[];
|
long volumeBuffer[];
|
||||||
double peaksBuffer[];
|
double peaksBuffer[];
|
||||||
double valesBuffer[];
|
double valesBuffer[];
|
||||||
double strUpBuffer[];
|
double strUpBuffer[];
|
||||||
|
double downTBuffer[];
|
||||||
double strDownBuffer[];
|
double strDownBuffer[];
|
||||||
double vwapMidBuffer[];
|
double vwapMidBuffer[];
|
||||||
|
double upTrendBuffer[];
|
||||||
double le1StartBuffer[];
|
double le1StartBuffer[];
|
||||||
double se1StartBuffer[];
|
double se1StartBuffer[];
|
||||||
double le2StartBuffer[];
|
double le2StartBuffer[];
|
||||||
@@ -207,6 +208,7 @@ struct X121Conditions
|
|||||||
double vwapFastBuffer[];
|
double vwapFastBuffer[];
|
||||||
double vwapSlowBuffer[];
|
double vwapSlowBuffer[];
|
||||||
double xhkSMLowBuffer[];
|
double xhkSMLowBuffer[];
|
||||||
|
double downTrendBuffer[];
|
||||||
double vwapPriceBuffer[];
|
double vwapPriceBuffer[];
|
||||||
double xhkRawLowBuffer[];
|
double xhkRawLowBuffer[];
|
||||||
double xhkSMOpenBuffer[];
|
double xhkSMOpenBuffer[];
|
||||||
@@ -242,6 +244,15 @@ struct X121Conditions
|
|||||||
//
|
//
|
||||||
// Conditions ...
|
// Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// XTrend ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isTrendBullish;
|
||||||
|
bool isTrendBearish;
|
||||||
|
bool isTrendSwitchedToBullish;
|
||||||
|
bool isTrendSwitchedToBearish;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isRsiSlopeBullish;
|
bool isRsiSlopeBullish;
|
||||||
bool isStrSlopeBullish;
|
bool isStrSlopeBullish;
|
||||||
@@ -601,6 +612,7 @@ struct X121Conditions
|
|||||||
// Buffers ...
|
// Buffers ...
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Clean(maBuffer);
|
||||||
Clean(rsiBuffer);
|
Clean(rsiBuffer);
|
||||||
Clean(atrBuffer);
|
Clean(atrBuffer);
|
||||||
Clean(strBuffer);
|
Clean(strBuffer);
|
||||||
@@ -619,12 +631,18 @@ struct X121Conditions
|
|||||||
Clean(lLLBuffer);
|
Clean(lLLBuffer);
|
||||||
Clean(hHHBuffer);
|
Clean(hHHBuffer);
|
||||||
Clean(hLLBuffer);
|
Clean(hLLBuffer);
|
||||||
|
Clean(upTBuffer);
|
||||||
|
Clean(adxBuffer);
|
||||||
|
Clean(adxPBuffer);
|
||||||
|
Clean(adxMBuffer);
|
||||||
Clean(volumeBuffer);
|
Clean(volumeBuffer);
|
||||||
Clean(peaksBuffer);
|
Clean(peaksBuffer);
|
||||||
Clean(valesBuffer);
|
Clean(valesBuffer);
|
||||||
Clean(strUpBuffer);
|
Clean(strUpBuffer);
|
||||||
|
Clean(downTBuffer);
|
||||||
Clean(strDownBuffer);
|
Clean(strDownBuffer);
|
||||||
Clean(vwapMidBuffer);
|
Clean(vwapMidBuffer);
|
||||||
|
Clean(upTrendBuffer);
|
||||||
Clean(le1StartBuffer);
|
Clean(le1StartBuffer);
|
||||||
Clean(se1StartBuffer);
|
Clean(se1StartBuffer);
|
||||||
Clean(le2StartBuffer);
|
Clean(le2StartBuffer);
|
||||||
@@ -636,6 +654,7 @@ struct X121Conditions
|
|||||||
Clean(vwapFastBuffer);
|
Clean(vwapFastBuffer);
|
||||||
Clean(vwapSlowBuffer);
|
Clean(vwapSlowBuffer);
|
||||||
Clean(xhkSMLowBuffer);
|
Clean(xhkSMLowBuffer);
|
||||||
|
Clean(downTrendBuffer);
|
||||||
Clean(vwapPriceBuffer);
|
Clean(vwapPriceBuffer);
|
||||||
Clean(xhkRawLowBuffer);
|
Clean(xhkRawLowBuffer);
|
||||||
Clean(xhkSMOpenBuffer);
|
Clean(xhkSMOpenBuffer);
|
||||||
@@ -660,6 +679,7 @@ struct X121Conditions
|
|||||||
Clean(donCloseLowerBuffer);
|
Clean(donCloseLowerBuffer);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
ArraySetAsSeries(maBuffer, true);
|
||||||
ArraySetAsSeries(rsiBuffer, true);
|
ArraySetAsSeries(rsiBuffer, true);
|
||||||
ArraySetAsSeries(atrBuffer, true);
|
ArraySetAsSeries(atrBuffer, true);
|
||||||
ArraySetAsSeries(strBuffer, true);
|
ArraySetAsSeries(strBuffer, true);
|
||||||
@@ -678,12 +698,18 @@ struct X121Conditions
|
|||||||
ArraySetAsSeries(lLLBuffer, true);
|
ArraySetAsSeries(lLLBuffer, true);
|
||||||
ArraySetAsSeries(hHHBuffer, true);
|
ArraySetAsSeries(hHHBuffer, true);
|
||||||
ArraySetAsSeries(hLLBuffer, true);
|
ArraySetAsSeries(hLLBuffer, true);
|
||||||
|
ArraySetAsSeries(upTBuffer, true);
|
||||||
|
ArraySetAsSeries(adxBuffer, true);
|
||||||
|
ArraySetAsSeries(adxPBuffer, true);
|
||||||
|
ArraySetAsSeries(adxMBuffer, true);
|
||||||
ArraySetAsSeries(volumeBuffer, true);
|
ArraySetAsSeries(volumeBuffer, true);
|
||||||
ArraySetAsSeries(peaksBuffer, true);
|
ArraySetAsSeries(peaksBuffer, true);
|
||||||
ArraySetAsSeries(valesBuffer, true);
|
ArraySetAsSeries(valesBuffer, true);
|
||||||
ArraySetAsSeries(strUpBuffer, true);
|
ArraySetAsSeries(strUpBuffer, true);
|
||||||
|
ArraySetAsSeries(downTBuffer, true);
|
||||||
ArraySetAsSeries(strDownBuffer, true);
|
ArraySetAsSeries(strDownBuffer, true);
|
||||||
ArraySetAsSeries(vwapMidBuffer, true);
|
ArraySetAsSeries(vwapMidBuffer, true);
|
||||||
|
ArraySetAsSeries(upTrendBuffer, true);
|
||||||
ArraySetAsSeries(le1StartBuffer, true);
|
ArraySetAsSeries(le1StartBuffer, true);
|
||||||
ArraySetAsSeries(se1StartBuffer, true);
|
ArraySetAsSeries(se1StartBuffer, true);
|
||||||
ArraySetAsSeries(le2StartBuffer, true);
|
ArraySetAsSeries(le2StartBuffer, true);
|
||||||
@@ -695,6 +721,7 @@ struct X121Conditions
|
|||||||
ArraySetAsSeries(vwapFastBuffer, true);
|
ArraySetAsSeries(vwapFastBuffer, true);
|
||||||
ArraySetAsSeries(vwapSlowBuffer, true);
|
ArraySetAsSeries(vwapSlowBuffer, true);
|
||||||
ArraySetAsSeries(xhkSMLowBuffer, true);
|
ArraySetAsSeries(xhkSMLowBuffer, true);
|
||||||
|
ArraySetAsSeries(downTrendBuffer, true);
|
||||||
ArraySetAsSeries(vwapPriceBuffer, true);
|
ArraySetAsSeries(vwapPriceBuffer, true);
|
||||||
ArraySetAsSeries(xhkRawLowBuffer, true);
|
ArraySetAsSeries(xhkRawLowBuffer, true);
|
||||||
ArraySetAsSeries(xhkSMOpenBuffer, true);
|
ArraySetAsSeries(xhkSMOpenBuffer, true);
|
||||||
@@ -1205,6 +1232,14 @@ struct X121Conditions
|
|||||||
ToString("isSarSwitchedToBearish", isSarSwitchedToBearish, ignoreFalseConditions, separator) +
|
ToString("isSarSwitchedToBearish", isSarSwitchedToBearish, ignoreFalseConditions, separator) +
|
||||||
//
|
//
|
||||||
"-----------------------" + separator +
|
"-----------------------" + separator +
|
||||||
|
"Trend ..." + separator +
|
||||||
|
"-----------------------" + separator +
|
||||||
|
ToString("isTrendBullish", isTrendBullish, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isTrendBearish", isTrendBearish, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isTrendSwitchedToBullish", isTrendSwitchedToBullish, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isTrendSwitchedToBearish", isTrendSwitchedToBearish, ignoreFalseConditions, separator) +
|
||||||
|
//
|
||||||
|
"-----------------------" + separator +
|
||||||
"STR ..." + separator +
|
"STR ..." + separator +
|
||||||
"-----------------------" + separator +
|
"-----------------------" + separator +
|
||||||
ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) +
|
ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) +
|
||||||
@@ -1502,8 +1537,6 @@ class XCX121Helper : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Helpers ...
|
// Helpers ...
|
||||||
XCX121XCCHelper *xccHelper;
|
|
||||||
XCX121XCTHelper *xctHelper;
|
|
||||||
XCX121XPVHelper *xpvHelper;
|
XCX121XPVHelper *xpvHelper;
|
||||||
XCX121XHKHelper *xhkHelper;
|
XCX121XHKHelper *xhkHelper;
|
||||||
XCX121XATRHelper *xatrHelper;
|
XCX121XATRHelper *xatrHelper;
|
||||||
@@ -1511,6 +1544,7 @@ class XCX121Helper : public XCBase
|
|||||||
XCX121XCHEHelper *xcheHelper;
|
XCX121XCHEHelper *xcheHelper;
|
||||||
XCX121XDONHelper *xdonHelper;
|
XCX121XDONHelper *xdonHelper;
|
||||||
XCX121XVWAPHelper *xvwapHelper;
|
XCX121XVWAPHelper *xvwapHelper;
|
||||||
|
XCX121XTRENDHelper *xtrendHelper;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructors ...
|
// Constructors ...
|
||||||
@@ -1523,8 +1557,6 @@ class XCX121Helper : public XCBase
|
|||||||
~XCX121Helper()
|
~XCX121Helper()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
delete xccHelper;
|
|
||||||
delete xctHelper;
|
|
||||||
delete xpvHelper;
|
delete xpvHelper;
|
||||||
delete xhkHelper;
|
delete xhkHelper;
|
||||||
delete xatrHelper;
|
delete xatrHelper;
|
||||||
@@ -1532,10 +1564,9 @@ class XCX121Helper : public XCBase
|
|||||||
delete xcheHelper;
|
delete xcheHelper;
|
||||||
delete xdonHelper;
|
delete xdonHelper;
|
||||||
delete xvwapHelper;
|
delete xvwapHelper;
|
||||||
|
delete xtrendHelper;
|
||||||
|
|
||||||
//
|
//
|
||||||
ZeroMemory(xccHelper);
|
|
||||||
ZeroMemory(xctHelper);
|
|
||||||
ZeroMemory(xpvHelper);
|
ZeroMemory(xpvHelper);
|
||||||
ZeroMemory(xhkHelper);
|
ZeroMemory(xhkHelper);
|
||||||
ZeroMemory(xatrHelper);
|
ZeroMemory(xatrHelper);
|
||||||
@@ -1543,6 +1574,7 @@ class XCX121Helper : public XCBase
|
|||||||
ZeroMemory(xcheHelper);
|
ZeroMemory(xcheHelper);
|
||||||
ZeroMemory(xdonHelper);
|
ZeroMemory(xdonHelper);
|
||||||
ZeroMemory(xvwapHelper);
|
ZeroMemory(xvwapHelper);
|
||||||
|
ZeroMemory(xtrendHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1597,8 +1629,6 @@ class XCX121Helper : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
mInputs = inputs;
|
mInputs = inputs;
|
||||||
xccInputs = inputs.xccInputs;
|
|
||||||
xctInputs = inputs.xctInputs;
|
|
||||||
xpvInputs = inputs.xpvInputs;
|
xpvInputs = inputs.xpvInputs;
|
||||||
xhkInputs = inputs.xhkInputs;
|
xhkInputs = inputs.xhkInputs;
|
||||||
xatrInputs = inputs.xatrInputs;
|
xatrInputs = inputs.xatrInputs;
|
||||||
@@ -1606,36 +1636,11 @@ class XCX121Helper : public XCBase
|
|||||||
xcheInputs = inputs.xcheInputs;
|
xcheInputs = inputs.xcheInputs;
|
||||||
xdonInputs = inputs.xdonInputs;
|
xdonInputs = inputs.xdonInputs;
|
||||||
xvwapInputs = inputs.xvwapInputs;
|
xvwapInputs = inputs.xvwapInputs;
|
||||||
|
xtrendInputs = inputs.xtrendInputs;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initial Helpers ...
|
// Initial Helpers ...
|
||||||
|
|
||||||
//
|
|
||||||
// XCC ...
|
|
||||||
xccHelper = new XCX121XCCHelper();
|
|
||||||
result = xccHelper.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
xccInputs //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// XCT ...
|
|
||||||
xctHelper = new XCX121XCTHelper();
|
|
||||||
result = xctHelper.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
xctInputs //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// XPV ...
|
// XPV ...
|
||||||
xpvHelper = new XCX121XPVHelper();
|
xpvHelper = new XCX121XPVHelper();
|
||||||
@@ -1727,6 +1732,19 @@ class XCX121Helper : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XTREND ...
|
||||||
|
xtrendHelper = new XCX121XTRENDHelper();
|
||||||
|
result = xtrendHelper.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
xtrendInputs //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (inputs.showRSI)
|
if (inputs.showRSI)
|
||||||
{
|
{
|
||||||
@@ -1907,6 +1925,28 @@ class XCX121Helper : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XTREND ...
|
||||||
|
bool GetTrendConditions(
|
||||||
|
X121XTRENDConditions &conditions, //
|
||||||
|
int barIndex = 0, //
|
||||||
|
int loopback = 5 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = xtrendHelper.GetConditions(
|
||||||
|
conditions,
|
||||||
|
barIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool GetConditions(
|
bool GetConditions(
|
||||||
X121Conditions &conditions, //
|
X121Conditions &conditions, //
|
||||||
@@ -2064,6 +2104,19 @@ class XCX121Helper : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XTREND ...
|
||||||
|
X121XTRENDConditions xtrendConditions;
|
||||||
|
result = GetTrendConditions(
|
||||||
|
xtrendConditions,
|
||||||
|
barIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fill Volume Buffer ...
|
// Fill Volume Buffer ...
|
||||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||||
@@ -2275,6 +2328,66 @@ class XCX121Helper : public XCBase
|
|||||||
conditions.isSMHKSwitchedToBullish = xhkConditions.isSMHKSwitchedToBullish;
|
conditions.isSMHKSwitchedToBullish = xhkConditions.isSMHKSwitchedToBullish;
|
||||||
conditions.isRawHKSwitchedToBullish = xhkConditions.isRawHKSwitchedToBullish;
|
conditions.isRawHKSwitchedToBullish = xhkConditions.isRawHKSwitchedToBullish;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XTREND ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Buffers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
xtrendConditions.upTrendBuffer,
|
||||||
|
conditions.upTrendBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
xtrendConditions.downTrendBuffer,
|
||||||
|
conditions.downTrendBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
xtrendConditions.maBuffer,
|
||||||
|
conditions.maBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
xtrendConditions.adxBuffer,
|
||||||
|
conditions.adxBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
xtrendConditions.adxPBuffer,
|
||||||
|
conditions.adxPBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
xtrendConditions.adxMBuffer,
|
||||||
|
conditions.adxMBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
xtrendConditions.upTBuffer,
|
||||||
|
conditions.upTBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
xtrendConditions.downTBuffer,
|
||||||
|
conditions.downTBuffer //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.isTrendBullish = xtrendConditions.isTrendBullish;
|
||||||
|
conditions.isTrendBearish = xtrendConditions.isTrendBearish;
|
||||||
|
conditions.isTrendSwitchedToBullish = xtrendConditions.isTrendSwitchedToBullish;
|
||||||
|
conditions.isTrendSwitchedToBearish = xtrendConditions.isTrendSwitchedToBearish;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XATR ...
|
// XATR ...
|
||||||
|
|
||||||
@@ -3224,8 +3337,6 @@ class XCX121Helper : public XCBase
|
|||||||
//
|
//
|
||||||
// Inputs ...
|
// Inputs ...
|
||||||
X121Inputs mInputs;
|
X121Inputs mInputs;
|
||||||
X121XCCInputs xccInputs;
|
|
||||||
X121XCTInputs xctInputs;
|
|
||||||
X121XPVInputs xpvInputs;
|
X121XPVInputs xpvInputs;
|
||||||
X121XHKInputs xhkInputs;
|
X121XHKInputs xhkInputs;
|
||||||
X121XATRInputs xatrInputs;
|
X121XATRInputs xatrInputs;
|
||||||
@@ -3233,6 +3344,7 @@ class XCX121Helper : public XCBase
|
|||||||
X121XSTRInputs xstrInputs;
|
X121XSTRInputs xstrInputs;
|
||||||
X121XCHEInputs xcheInputs;
|
X121XCHEInputs xcheInputs;
|
||||||
X121XVWAPInputs xvwapInputs;
|
X121XVWAPInputs xvwapInputs;
|
||||||
|
X121XTRENDInputs xtrendInputs;
|
||||||
|
|
||||||
//
|
//
|
||||||
int mRSIHandler;
|
int mRSIHandler;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -39,9 +39,9 @@ input group "Market";
|
|||||||
input ENUM_APPLIED_PRICE trendPriceType = PRICE_CLOSE; // Detect Trend Price Type
|
input ENUM_APPLIED_PRICE trendPriceType = PRICE_CLOSE; // Detect Trend Price Type
|
||||||
|
|
||||||
input group "MA Detection";
|
input group "MA Detection";
|
||||||
input int maLength = 50; // MA Length
|
input int maLength = 50; // MA Length
|
||||||
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method
|
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method
|
||||||
input ENUM_APPLIED_PRICE maAppliedTo; // MA Applied To
|
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
||||||
|
|
||||||
input group "ADX Detection";
|
input group "ADX Detection";
|
||||||
input int adxLength = 14; // ADX Length
|
input int adxLength = 14; // ADX Length
|
||||||
@@ -65,7 +65,7 @@ input bool showDownTrend = true; // Show Down Trend
|
|||||||
#property indicator_chart_window
|
#property indicator_chart_window
|
||||||
|
|
||||||
//
|
//
|
||||||
#property indicator_buffers 6
|
#property indicator_buffers 8
|
||||||
#property indicator_plots 2
|
#property indicator_plots 2
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -113,6 +113,14 @@ double adxPBuffer[];
|
|||||||
#define adxMBufferIndex mLastBufferIndex + 4
|
#define adxMBufferIndex mLastBufferIndex + 4
|
||||||
double adxMBuffer[];
|
double adxMBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#define upTBufferIndex mLastBufferIndex + 5
|
||||||
|
double upTBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#define downTBufferIndex mLastBufferIndex + 6
|
||||||
|
double downTBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Variables, Properties and etc ...
|
// Variables, Properties and etc ...
|
||||||
|
|
||||||
@@ -469,6 +477,14 @@ void DefineBuffers()
|
|||||||
//
|
//
|
||||||
ArraySetAsSeries(adxMBuffer, true);
|
ArraySetAsSeries(adxMBuffer, true);
|
||||||
SetIndexBuffer(adxMBufferIndex, adxMBuffer, INDICATOR_CALCULATIONS);
|
SetIndexBuffer(adxMBufferIndex, adxMBuffer, INDICATOR_CALCULATIONS);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArraySetAsSeries(upTBuffer, true);
|
||||||
|
SetIndexBuffer(upTBufferIndex, upTBuffer, INDICATOR_CALCULATIONS);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArraySetAsSeries(downTBuffer, true);
|
||||||
|
SetIndexBuffer(downTBufferIndex, downTBuffer, INDICATOR_CALCULATIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -602,18 +618,21 @@ void CalculateTrend(
|
|||||||
// iValue = iLastValue;
|
// iValue = iLastValue;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// //
|
//
|
||||||
// double iValue = low[bar_index] - points10;
|
double selectedValue = low[bar_index] - points10;
|
||||||
|
|
||||||
//
|
//
|
||||||
double iValue =
|
double iValue =
|
||||||
!IsBullish(lastTrendDir) ? low[bar_index] - points10
|
!IsBullish(lastTrendDir) ? selectedValue
|
||||||
: !showOnlyTrendStart
|
: !showOnlyTrendStart
|
||||||
? lastValue
|
? lastValue
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
upTrendBuffer[bar_index] = iValue;
|
upTrendBuffer[bar_index] = iValue;
|
||||||
|
upTBuffer[bar_index] = selectedValue;
|
||||||
|
|
||||||
|
//
|
||||||
downTrendBuffer[bar_index] = 0;
|
downTrendBuffer[bar_index] = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -633,12 +652,12 @@ void CalculateTrend(
|
|||||||
// iValue = iLastValue;
|
// iValue = iLastValue;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// //
|
//
|
||||||
// double iValue = high[bar_index] + points10;
|
double selectedValue = high[bar_index] + points10;
|
||||||
|
|
||||||
//
|
//
|
||||||
double iValue =
|
double iValue =
|
||||||
!IsBearish(lastTrendDir) ? high[bar_index] + points10
|
!IsBearish(lastTrendDir) ? selectedValue
|
||||||
: !showOnlyTrendStart
|
: !showOnlyTrendStart
|
||||||
? lastValue
|
? lastValue
|
||||||
: 0;
|
: 0;
|
||||||
@@ -646,6 +665,7 @@ void CalculateTrend(
|
|||||||
//
|
//
|
||||||
upTrendBuffer[bar_index] = 0;
|
upTrendBuffer[bar_index] = 0;
|
||||||
downTrendBuffer[bar_index] = iValue;
|
downTrendBuffer[bar_index] = iValue;
|
||||||
|
downTBuffer[bar_index] = selectedValue;
|
||||||
|
|
||||||
//
|
//
|
||||||
lastValue = iValue;
|
lastValue = iValue;
|
||||||
@@ -669,6 +689,10 @@ void CalculateTrend(
|
|||||||
upTrendBuffer[bar_index] = 0;
|
upTrendBuffer[bar_index] = 0;
|
||||||
downTrendBuffer[bar_index] = 0;
|
downTrendBuffer[bar_index] = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
upTBuffer[bar_index] = 0;
|
||||||
|
downTBuffer[bar_index] = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
lastValue = 0;
|
lastValue = 0;
|
||||||
lastTrendDir = X_DIRECTION_NONE;
|
lastTrendDir = X_DIRECTION_NONE;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
//
|
//
|
||||||
// Imports ...
|
// Imports ...
|
||||||
#include "../../Classes/x-saherelm.x-expert.class.mq5"
|
#include "../../Classes/x-saherelm.x-expert.class.mq5"
|
||||||
#include "../../Helpers/x-saherelm.x121.xatr.helper.mq5"
|
#include "../../Helpers/x-saherelm.x121.xct.helper.mq5"
|
||||||
#include "../../Helpers/x-saherelm.x121.xcc.helper.mq5"
|
#include "../../Helpers/x-saherelm.x121.xcc.helper.mq5"
|
||||||
#include "../Classes/x-121.smc.x-tradehandler.class.mq5"
|
#include "../Classes/x-121.smc.x-tradehandler.class.mq5"
|
||||||
#include "../Libraries/x-121.smc.lib.mq5"
|
#include "../Libraries/x-121.smc.lib.mq5"
|
||||||
@@ -1341,8 +1341,8 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
ZeroMemory(mTradeHandler);
|
ZeroMemory(mTradeHandler);
|
||||||
|
|
||||||
//
|
//
|
||||||
delet xccHelper;
|
delete xccHelper;
|
||||||
delet xctHelper;
|
delete xctHelper;
|
||||||
delete mTradeHandler;
|
delete mTradeHandler;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -758,13 +758,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
x121Inputs.xatrInputs.atrSmoothingMode = X_MA_MODE_EMA;
|
x121Inputs.xatrInputs.atrSmoothingMode = X_MA_MODE_EMA;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XCC ...
|
// XTREND ...
|
||||||
x121Inputs.xccInputs.showCandles = false; // false;
|
x121Inputs.xtrendInputs.showUpTrend = showAll || false;
|
||||||
|
x121Inputs.xtrendInputs.showDownTrend = showAll || false;
|
||||||
//
|
x121Inputs.xtrendInputs.showOnlyTrendStart = showAll || false;
|
||||||
// XCT ...
|
|
||||||
x121Inputs.xctInputs.clr = clrBlueViolet;
|
|
||||||
x121Inputs.xctInputs.showCandleTime = false; // false;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// XPV ...
|
// XPV ...
|
||||||
|
|||||||
Reference in New Issue
Block a user