add supports for XASCT in mCycle ...
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
#include "../Helpers/x-saherelm.xche.helper.mq5"
|
#include "../Helpers/x-saherelm.xche.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.xosc.helper.mq5"
|
#include "../Helpers/x-saherelm.xosc.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.xama.helper.mq5"
|
#include "../Helpers/x-saherelm.xama.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xasct.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.xhull.helper.mq5"
|
#include "../Helpers/x-saherelm.xhull.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.xsslc.helper.mq5"
|
#include "../Helpers/x-saherelm.xsslc.helper.mq5"
|
||||||
|
|
||||||
@@ -101,6 +102,7 @@ public:
|
|||||||
XSTRInputs strInputs;
|
XSTRInputs strInputs;
|
||||||
XDONInputs donInputs;
|
XDONInputs donInputs;
|
||||||
XOSCInputs oscInputs;
|
XOSCInputs oscInputs;
|
||||||
|
XASCTInputs asctInputs;
|
||||||
XHULLInputs hullInputs;
|
XHULLInputs hullInputs;
|
||||||
XSSLCInputs sslcInputs;
|
XSSLCInputs sslcInputs;
|
||||||
|
|
||||||
@@ -183,6 +185,10 @@ public:
|
|||||||
{
|
{
|
||||||
hullInputs.Default();
|
hullInputs.Default();
|
||||||
}
|
}
|
||||||
|
if (!asctInputs.IsValid())
|
||||||
|
{
|
||||||
|
asctInputs.Default();
|
||||||
|
}
|
||||||
if (!sslcInputs.IsValid())
|
if (!sslcInputs.IsValid())
|
||||||
{
|
{
|
||||||
sslcInputs.Default();
|
sslcInputs.Default();
|
||||||
@@ -208,6 +214,7 @@ public:
|
|||||||
cMarketInputs.cheInputs = this.cheInputs;
|
cMarketInputs.cheInputs = this.cheInputs;
|
||||||
cMarketInputs.ichInputs = this.ichInputs;
|
cMarketInputs.ichInputs = this.ichInputs;
|
||||||
cMarketInputs.donInputs = this.donInputs;
|
cMarketInputs.donInputs = this.donInputs;
|
||||||
|
cMarketInputs.asctInputs = this.asctInputs;
|
||||||
cMarketInputs.hullInputs = this.hullInputs;
|
cMarketInputs.hullInputs = this.hullInputs;
|
||||||
cMarketInputs.sslcInputs = this.sslcInputs;
|
cMarketInputs.sslcInputs = this.sslcInputs;
|
||||||
result = cMarketInputs.Init(
|
result = cMarketInputs.Init(
|
||||||
@@ -237,6 +244,7 @@ public:
|
|||||||
sMarketInputs.cheInputs = this.cheInputs;
|
sMarketInputs.cheInputs = this.cheInputs;
|
||||||
sMarketInputs.ichInputs = this.ichInputs;
|
sMarketInputs.ichInputs = this.ichInputs;
|
||||||
sMarketInputs.donInputs = this.donInputs;
|
sMarketInputs.donInputs = this.donInputs;
|
||||||
|
sMarketInputs.asctInputs = this.asctInputs;
|
||||||
sMarketInputs.hullInputs = this.hullInputs;
|
sMarketInputs.hullInputs = this.hullInputs;
|
||||||
sMarketInputs.sslcInputs = this.sslcInputs;
|
sMarketInputs.sslcInputs = this.sslcInputs;
|
||||||
result = sMarketInputs.Init(
|
result = sMarketInputs.Init(
|
||||||
@@ -266,6 +274,7 @@ public:
|
|||||||
mMarketInputs.cheInputs = this.cheInputs;
|
mMarketInputs.cheInputs = this.cheInputs;
|
||||||
mMarketInputs.ichInputs = this.ichInputs;
|
mMarketInputs.ichInputs = this.ichInputs;
|
||||||
mMarketInputs.donInputs = this.donInputs;
|
mMarketInputs.donInputs = this.donInputs;
|
||||||
|
mMarketInputs.asctInputs = this.asctInputs;
|
||||||
mMarketInputs.hullInputs = this.hullInputs;
|
mMarketInputs.hullInputs = this.hullInputs;
|
||||||
mMarketInputs.sslcInputs = this.sslcInputs;
|
mMarketInputs.sslcInputs = this.sslcInputs;
|
||||||
result = mMarketInputs.Init(
|
result = mMarketInputs.Init(
|
||||||
@@ -295,6 +304,7 @@ public:
|
|||||||
lMarketInputs.cheInputs = this.cheInputs;
|
lMarketInputs.cheInputs = this.cheInputs;
|
||||||
lMarketInputs.ichInputs = this.ichInputs;
|
lMarketInputs.ichInputs = this.ichInputs;
|
||||||
lMarketInputs.donInputs = this.donInputs;
|
lMarketInputs.donInputs = this.donInputs;
|
||||||
|
lMarketInputs.asctInputs = this.asctInputs;
|
||||||
lMarketInputs.hullInputs = this.hullInputs;
|
lMarketInputs.hullInputs = this.hullInputs;
|
||||||
lMarketInputs.sslcInputs = this.sslcInputs;
|
lMarketInputs.sslcInputs = this.sslcInputs;
|
||||||
result = lMarketInputs.Init(
|
result = lMarketInputs.Init(
|
||||||
@@ -324,6 +334,7 @@ public:
|
|||||||
hMarketInputs.cheInputs = this.cheInputs;
|
hMarketInputs.cheInputs = this.cheInputs;
|
||||||
hMarketInputs.ichInputs = this.ichInputs;
|
hMarketInputs.ichInputs = this.ichInputs;
|
||||||
hMarketInputs.donInputs = this.donInputs;
|
hMarketInputs.donInputs = this.donInputs;
|
||||||
|
hMarketInputs.asctInputs = this.asctInputs;
|
||||||
hMarketInputs.hullInputs = this.hullInputs;
|
hMarketInputs.hullInputs = this.hullInputs;
|
||||||
hMarketInputs.sslcInputs = this.sslcInputs;
|
hMarketInputs.sslcInputs = this.sslcInputs;
|
||||||
result = hMarketInputs.Init(
|
result = hMarketInputs.Init(
|
||||||
@@ -378,6 +389,7 @@ public:
|
|||||||
donInputs.IsValid() &&
|
donInputs.IsValid() &&
|
||||||
oscInputs.IsValid() &&
|
oscInputs.IsValid() &&
|
||||||
ichInputs.IsValid() &&
|
ichInputs.IsValid() &&
|
||||||
|
asctInputs.IsValid() &&
|
||||||
hullInputs.IsValid() &&
|
hullInputs.IsValid() &&
|
||||||
sslcInputs.IsValid() &&
|
sslcInputs.IsValid() &&
|
||||||
//
|
//
|
||||||
@@ -435,6 +447,7 @@ public:
|
|||||||
donInputs.Clean();
|
donInputs.Clean();
|
||||||
oscInputs.Clean();
|
oscInputs.Clean();
|
||||||
ichInputs.Clean();
|
ichInputs.Clean();
|
||||||
|
asctInputs.Clean();
|
||||||
hullInputs.Clean();
|
hullInputs.Clean();
|
||||||
sslcInputs.Clean();
|
sslcInputs.Clean();
|
||||||
//
|
//
|
||||||
@@ -487,6 +500,7 @@ public:
|
|||||||
donInputs.Default();
|
donInputs.Default();
|
||||||
oscInputs.Default();
|
oscInputs.Default();
|
||||||
ichInputs.Default();
|
ichInputs.Default();
|
||||||
|
asctInputs.Default();
|
||||||
hullInputs.Default();
|
hullInputs.Default();
|
||||||
sslcInputs.Default();
|
sslcInputs.Default();
|
||||||
|
|
||||||
@@ -522,6 +536,7 @@ public:
|
|||||||
result = MathMax(result, donInputs.Max());
|
result = MathMax(result, donInputs.Max());
|
||||||
result = MathMax(result, oscInputs.Max());
|
result = MathMax(result, oscInputs.Max());
|
||||||
result = MathMax(result, ichInputs.Max());
|
result = MathMax(result, ichInputs.Max());
|
||||||
|
result = MathMax(result, asctInputs.Max());
|
||||||
result = MathMax(result, hullInputs.Max());
|
result = MathMax(result, hullInputs.Max());
|
||||||
result = MathMax(result, sslcInputs.Max());
|
result = MathMax(result, sslcInputs.Max());
|
||||||
|
|
||||||
@@ -1665,21 +1680,21 @@ struct X121ProviderDescriptor
|
|||||||
//
|
//
|
||||||
cHasLong
|
cHasLong
|
||||||
//
|
//
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
sHasLong
|
// sHasLong
|
||||||
//
|
// //
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
mHasLong
|
// mHasLong
|
||||||
//
|
// //
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
lHasLong
|
// lHasLong
|
||||||
//
|
// //
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
hHasLong
|
// hHasLong
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1688,21 +1703,21 @@ struct X121ProviderDescriptor
|
|||||||
//
|
//
|
||||||
cHasShort
|
cHasShort
|
||||||
//
|
//
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
sHasShort
|
// sHasShort
|
||||||
//
|
// //
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
mHasShort
|
// mHasShort
|
||||||
//
|
// //
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
lHasShort
|
// lHasShort
|
||||||
//
|
// //
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
hHasShort
|
// hHasShort
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1720,10 +1735,10 @@ struct X121ProviderDescriptor
|
|||||||
//
|
//
|
||||||
bool hasSignal =
|
bool hasSignal =
|
||||||
//
|
//
|
||||||
isScorePassed &&
|
// isScorePassed &&
|
||||||
(hasLong
|
(hasLong
|
||||||
? longVerifiers > 1
|
? longVerifiers >= 1
|
||||||
: shortVerifiers > 1)
|
: shortVerifiers >= 1)
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (!hasSignal)
|
if (!hasSignal)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "../Helpers/x-saherelm.xosc.helper.mq5"
|
#include "../Helpers/x-saherelm.xosc.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.xstr.helper.mq5"
|
#include "../Helpers/x-saherelm.xstr.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.xich.helper.mq5"
|
#include "../Helpers/x-saherelm.xich.helper.mq5"
|
||||||
|
#include "../Helpers/x-saherelm.xasct.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.xhull.helper.mq5"
|
#include "../Helpers/x-saherelm.xhull.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.xsslc.helper.mq5"
|
#include "../Helpers/x-saherelm.xsslc.helper.mq5"
|
||||||
|
|
||||||
@@ -178,6 +179,7 @@ public:
|
|||||||
XCHEInputs cheInputs; // CHE Inputs ...
|
XCHEInputs cheInputs; // CHE Inputs ...
|
||||||
XICHInputs ichInputs; // ICH Inputs ...
|
XICHInputs ichInputs; // ICH Inputs ...
|
||||||
XDONInputs donInputs; // DON Inputs ...
|
XDONInputs donInputs; // DON Inputs ...
|
||||||
|
XASCTInputs asctInputs; // ASCT Inputs ...
|
||||||
XHULLInputs hullInputs; // HULL Inputs ...
|
XHULLInputs hullInputs; // HULL Inputs ...
|
||||||
XSSLCInputs sslcInputs; // SSLC Inputs ...
|
XSSLCInputs sslcInputs; // SSLC Inputs ...
|
||||||
|
|
||||||
@@ -266,6 +268,7 @@ public:
|
|||||||
XCHEInputs &mCheInputs, // CHE Inputs
|
XCHEInputs &mCheInputs, // CHE Inputs
|
||||||
XICHInputs &mIchInputs, // ICH Inputs ...
|
XICHInputs &mIchInputs, // ICH Inputs ...
|
||||||
XDONInputs &mDonInputs, // DON Inputs ...
|
XDONInputs &mDonInputs, // DON Inputs ...
|
||||||
|
XASCTInputs &mAsctInputs, // ASCT Inputs
|
||||||
XHULLInputs &mHullInputs, // HULL Inputs ...
|
XHULLInputs &mHullInputs, // HULL Inputs ...
|
||||||
XSSLCInputs &mSslcInputs, // SSLC Inputs ...
|
XSSLCInputs &mSslcInputs, // SSLC Inputs ...
|
||||||
int mHostBarIndex = 0, // Specified Host Period Bar Index
|
int mHostBarIndex = 0, // Specified Host Period Bar Index
|
||||||
@@ -301,6 +304,7 @@ public:
|
|||||||
cheInputs = mCheInputs;
|
cheInputs = mCheInputs;
|
||||||
ichInputs = mIchInputs;
|
ichInputs = mIchInputs;
|
||||||
donInputs = mDonInputs;
|
donInputs = mDonInputs;
|
||||||
|
asctInputs = mAsctInputs;
|
||||||
hullInputs = mHullInputs;
|
hullInputs = mHullInputs;
|
||||||
sslcInputs = mSslcInputs;
|
sslcInputs = mSslcInputs;
|
||||||
|
|
||||||
@@ -334,6 +338,7 @@ public:
|
|||||||
cheInputs.Clean();
|
cheInputs.Clean();
|
||||||
ichInputs.Clean();
|
ichInputs.Clean();
|
||||||
donInputs.Clean();
|
donInputs.Clean();
|
||||||
|
asctInputs.Clean();
|
||||||
hullInputs.Clean();
|
hullInputs.Clean();
|
||||||
sslcInputs.Clean();
|
sslcInputs.Clean();
|
||||||
|
|
||||||
@@ -367,6 +372,7 @@ public:
|
|||||||
cheInputs.Default();
|
cheInputs.Default();
|
||||||
ichInputs.Default();
|
ichInputs.Default();
|
||||||
donInputs.Default();
|
donInputs.Default();
|
||||||
|
asctInputs.Default();
|
||||||
hullInputs.Default();
|
hullInputs.Default();
|
||||||
sslcInputs.Default();
|
sslcInputs.Default();
|
||||||
|
|
||||||
@@ -476,6 +482,13 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = asctInputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = sslcInputs.IsValid();
|
result = sslcInputs.IsValid();
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -509,6 +522,7 @@ public:
|
|||||||
result = MathMax(result, cheInputs.Max());
|
result = MathMax(result, cheInputs.Max());
|
||||||
result = MathMax(result, ichInputs.Max());
|
result = MathMax(result, ichInputs.Max());
|
||||||
result = MathMax(result, donInputs.Max());
|
result = MathMax(result, donInputs.Max());
|
||||||
|
result = MathMax(result, asctInputs.Max());
|
||||||
result = MathMax(result, hullInputs.Max());
|
result = MathMax(result, hullInputs.Max());
|
||||||
result = MathMax(result, sslcInputs.Max());
|
result = MathMax(result, sslcInputs.Max());
|
||||||
|
|
||||||
@@ -558,6 +572,11 @@ public:
|
|||||||
XOHCL hkBars[];
|
XOHCL hkBars[];
|
||||||
XOHCL smHKBars[];
|
XOHCL smHKBars[];
|
||||||
|
|
||||||
|
//
|
||||||
|
// XASCT ...
|
||||||
|
double asctLongs[];
|
||||||
|
double asctShorts[];
|
||||||
|
|
||||||
//
|
//
|
||||||
// XICH ...
|
// XICH ...
|
||||||
double ichTenkanSens[];
|
double ichTenkanSens[];
|
||||||
@@ -685,6 +704,11 @@ public:
|
|||||||
bool isZigZagInPeak;
|
bool isZigZagInPeak;
|
||||||
bool isZigZagInVale;
|
bool isZigZagInVale;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XASCT ...
|
||||||
|
bool isASCTLong;
|
||||||
|
bool isASCTShort;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XHULL ...
|
// XHULL ...
|
||||||
bool isHullBullish;
|
bool isHullBullish;
|
||||||
@@ -967,6 +991,8 @@ public:
|
|||||||
//
|
//
|
||||||
// Buffers ...
|
// Buffers ...
|
||||||
Clean(bars);
|
Clean(bars);
|
||||||
|
Clean(asctLongs);
|
||||||
|
Clean(asctShorts);
|
||||||
Clean(hkBars);
|
Clean(hkBars);
|
||||||
Clean(smHKBars);
|
Clean(smHKBars);
|
||||||
Clean(ichTenkanSens);
|
Clean(ichTenkanSens);
|
||||||
@@ -1053,6 +1079,8 @@ public:
|
|||||||
// Buffers ...
|
// Buffers ...
|
||||||
ArraySetAsSeries(bars, true);
|
ArraySetAsSeries(bars, true);
|
||||||
ArraySetAsSeries(hkBars, true);
|
ArraySetAsSeries(hkBars, true);
|
||||||
|
ArraySetAsSeries(asctLongs, true);
|
||||||
|
ArraySetAsSeries(asctShorts, true);
|
||||||
ArraySetAsSeries(smHKBars, true);
|
ArraySetAsSeries(smHKBars, true);
|
||||||
ArraySetAsSeries(ichTenkanSens, true);
|
ArraySetAsSeries(ichTenkanSens, true);
|
||||||
ArraySetAsSeries(ichKijunSens, true);
|
ArraySetAsSeries(ichKijunSens, true);
|
||||||
@@ -1139,6 +1167,11 @@ public:
|
|||||||
isZigZagInPeak = false;
|
isZigZagInPeak = false;
|
||||||
isZigZagInVale = false;
|
isZigZagInVale = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XASCT ...
|
||||||
|
isASCTLong = false;
|
||||||
|
isASCTShort = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XHULL ...
|
// XHULL ...
|
||||||
isHullBullish = false;
|
isHullBullish = false;
|
||||||
@@ -1388,6 +1421,23 @@ public:
|
|||||||
multiplier = 1;
|
multiplier = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XASCT ...
|
||||||
|
if (isASCTLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore++;
|
||||||
|
bullScore++;
|
||||||
|
bearScore--;
|
||||||
|
}
|
||||||
|
if (isASCTShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore--;
|
||||||
|
bearScore++;
|
||||||
|
bearScore++;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Candlestic ...
|
// Candlestic ...
|
||||||
if (isLastBullish)
|
if (isLastBullish)
|
||||||
@@ -2222,6 +2272,18 @@ public:
|
|||||||
;
|
;
|
||||||
candlestickStr = SetLabel("XOHCL: ", candlestickStr, separator);
|
candlestickStr = SetLabel("XOHCL: ", candlestickStr, separator);
|
||||||
|
|
||||||
|
//
|
||||||
|
// XASCT ...
|
||||||
|
string asctStr =
|
||||||
|
//
|
||||||
|
ToString("isASCTLong", isASCTLong, ignoreFalseConditions, separator) +
|
||||||
|
ToString("isASCTShort", isASCTShort, ignoreFalseConditions, separator) +
|
||||||
|
|
||||||
|
""
|
||||||
|
//
|
||||||
|
;
|
||||||
|
asctStr = SetLabel("XASCT: ", asctStr, separator);
|
||||||
|
|
||||||
//
|
//
|
||||||
// XZG ...
|
// XZG ...
|
||||||
string zgStr =
|
string zgStr =
|
||||||
@@ -2489,6 +2551,7 @@ public:
|
|||||||
? commonStr
|
? commonStr
|
||||||
: (commonStr +
|
: (commonStr +
|
||||||
candlestickStr +
|
candlestickStr +
|
||||||
|
asctStr +
|
||||||
zgStr +
|
zgStr +
|
||||||
strStr +
|
strStr +
|
||||||
cheStr +
|
cheStr +
|
||||||
@@ -2821,11 +2884,11 @@ public:
|
|||||||
//
|
//
|
||||||
// Check Has Conditions opr Not ...
|
// Check Has Conditions opr Not ...
|
||||||
bool HasConditions(
|
bool HasConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
bool &hasLong, // Hold Long Conditions Result
|
bool &hasLong, // Hold Long Conditions Result
|
||||||
bool &hasShort, // Hold Short Conditions Result
|
bool &hasShort, // Hold Short Conditions Result
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2845,9 +2908,9 @@ public:
|
|||||||
//
|
//
|
||||||
// Check Has Long Conditions opr Not ...
|
// Check Has Long Conditions opr Not ...
|
||||||
virtual bool HasLongConditions(
|
virtual bool HasLongConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -2856,9 +2919,9 @@ public:
|
|||||||
//
|
//
|
||||||
// Check Has Short Conditions opr Not ...
|
// Check Has Short Conditions opr Not ...
|
||||||
virtual bool HasShortConditions(
|
virtual bool HasShortConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -2896,6 +2959,7 @@ public:
|
|||||||
XSCXOSCHelper osc;
|
XSCXOSCHelper osc;
|
||||||
XSCXICHHelper ich;
|
XSCXICHHelper ich;
|
||||||
XSCXDONHelper don;
|
XSCXDONHelper don;
|
||||||
|
XSCXASCTHelper asct;
|
||||||
XSCXHULLHelper hull;
|
XSCXHULLHelper hull;
|
||||||
XSCXSSLCHelper sslc;
|
XSCXSSLCHelper sslc;
|
||||||
|
|
||||||
@@ -3059,6 +3123,23 @@ public:
|
|||||||
//
|
//
|
||||||
// Filling Buffers ...
|
// Filling Buffers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// XASCT ...
|
||||||
|
|
||||||
|
//
|
||||||
|
asct.CopyLong(
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
conditions.asctLongs //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
asct.CopyShort(
|
||||||
|
start,
|
||||||
|
count,
|
||||||
|
conditions.asctShorts //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// XHULL ...
|
// XHULL ...
|
||||||
|
|
||||||
@@ -3811,6 +3892,13 @@ public:
|
|||||||
bool isSMHKSwitchedToBullish = cSMHKBar.IsBullish() && !pSMHKBar.IsBullish();
|
bool isSMHKSwitchedToBullish = cSMHKBar.IsBullish() && !pSMHKBar.IsBullish();
|
||||||
bool isSMHKSwitchedToBearish = cSMHKBar.IsBearish() && !pSMHKBar.IsBearish();
|
bool isSMHKSwitchedToBearish = cSMHKBar.IsBearish() && !pSMHKBar.IsBearish();
|
||||||
|
|
||||||
|
//
|
||||||
|
// XASCT ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isASCTLong = conditions.asctLongs[zIndex] > 0;
|
||||||
|
bool isASCTShort = conditions.asctShorts[zIndex] > 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSSLC ...
|
// XSSLC ...
|
||||||
|
|
||||||
@@ -4486,6 +4574,10 @@ public:
|
|||||||
conditions.isCurrentMidLineOverLastMidLine = isCurrentMidLineOverLastMidLine;
|
conditions.isCurrentMidLineOverLastMidLine = isCurrentMidLineOverLastMidLine;
|
||||||
conditions.isCurrentMidLineUnderLastMidLine = isCurrentMidLineUnderLastMidLine;
|
conditions.isCurrentMidLineUnderLastMidLine = isCurrentMidLineUnderLastMidLine;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.isASCTLong = isASCTLong;
|
||||||
|
conditions.isASCTShort = isASCTShort;
|
||||||
|
|
||||||
//
|
//
|
||||||
conditions.isSSLCBullish = isSSLCBullish;
|
conditions.isSSLCBullish = isSSLCBullish;
|
||||||
conditions.isSSLCBearish = isSSLCBearish;
|
conditions.isSSLCBearish = isSSLCBearish;
|
||||||
@@ -4719,6 +4811,19 @@ public:
|
|||||||
//
|
//
|
||||||
// Init Helpers ...
|
// Init Helpers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// XASCT ...
|
||||||
|
result = asct.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mInputs.asctInputs
|
||||||
|
//
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// XHULL ...
|
// XHULL ...
|
||||||
result = hull.Init(
|
result = hull.Init(
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ async function getRecursiveFilesList(
|
|||||||
* @param {string} path Folder Path ...
|
* @param {string} path Folder Path ...
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async function extractFiles(path = "", ext = []) {
|
async function extractFiles(path = "", ext = [], excludeWorkspaceFolders = []) {
|
||||||
//
|
//
|
||||||
const result = [];
|
const result = [];
|
||||||
|
|
||||||
|
|||||||
+78
-26
@@ -25,8 +25,10 @@
|
|||||||
//
|
//
|
||||||
#include "../Classes/x-saherelm.x121.xea.class.mq5"
|
#include "../Classes/x-saherelm.x121.xea.class.mq5"
|
||||||
#include "../Signallers/x-saherelm.x92.signaller.class.mq5"
|
#include "../Signallers/x-saherelm.x92.signaller.class.mq5"
|
||||||
|
#include "../Signallers/x-saherelm.xsp.signaller.class.mq5"
|
||||||
#include "../Signallers/x-saherelm.x110.signaller.class.mq5"
|
#include "../Signallers/x-saherelm.x110.signaller.class.mq5"
|
||||||
#include "../Signallers/x-saherelm.x121.signaller.class.mq5"
|
#include "../Signallers/x-saherelm.x121.signaller.class.mq5"
|
||||||
|
#include "../Signallers/x-saherelm.x128.signaller.class.mq5"
|
||||||
#include "../Signallers/x-saherelm.x786.signaller.class.mq5"
|
#include "../Signallers/x-saherelm.x786.signaller.class.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -41,11 +43,6 @@ input string x121EASymbols = "EURUSDb"; // Symbols
|
|||||||
//
|
//
|
||||||
input bool x121EAAllowLong = true; // Allow Long Trades
|
input bool x121EAAllowLong = true; // Allow Long Trades
|
||||||
input bool x121EAAllowShort = true; // Allow Short Trades
|
input bool x121EAAllowShort = true; // Allow Short Trades
|
||||||
input int x121EAManageInterval = 0; // Manager Check Intervals Seconds
|
|
||||||
input int x121EAMaxAllowedPositions = 5; // Max Allowed Positions
|
|
||||||
input double x121EAMaxAllowedSpread = 0; // Max Allowed Spred for Opening Trades
|
|
||||||
input double x121EAMinProfitPerTrade = 0.6; // Min Profit Per Trade based On Volume Factor (Hedge)
|
|
||||||
input double x121EAMinProfitPerVolumeFactor = 0.01; // Min Volume Factor for Calculating Profit (Hedge)
|
|
||||||
input double x121EAMaxAllowedDrawdownFactor = 0.002; // Max Allowed Drawdown Factor
|
input double x121EAMaxAllowedDrawdownFactor = 0.002; // Max Allowed Drawdown Factor
|
||||||
input double x121EAVolume = 0.01; // Static Volume
|
input double x121EAVolume = 0.01; // Static Volume
|
||||||
|
|
||||||
@@ -229,33 +226,45 @@ bool InitialEA()
|
|||||||
// X786 Signaller ...
|
// X786 Signaller ...
|
||||||
X786Signaller *x786Signaller = new X786Signaller();
|
X786Signaller *x786Signaller = new X786Signaller();
|
||||||
x786Signaller.Default();
|
x786Signaller.Default();
|
||||||
x786Signaller.allowLong = x121EAAllowLong;
|
x786Signaller.maxAllowedLong = 0;
|
||||||
x786Signaller.allowShort = x121EAAllowShort;
|
x786Signaller.maxAllowedShort = 0;
|
||||||
|
x786Signaller.allowLong = false; // x121EAAllowLong;
|
||||||
|
x786Signaller.allowShort = false; // x121EAAllowShort;
|
||||||
x786Signaller.maxAllowedOpenPositionAge = 0;
|
x786Signaller.maxAllowedOpenPositionAge = 0;
|
||||||
x786Signaller.minRequiredProfitPerTrade = 1;
|
x786Signaller.minRequiredProfitPerTrade = 0;
|
||||||
x786Signaller.openNextPositionOnProfit = true;
|
x786Signaller.openNextPositionOnProfit = false;
|
||||||
|
x786Signaller.staticVolumeLong = x121EAVolume;
|
||||||
|
x786Signaller.staticVolumeShort = x121EAVolume;
|
||||||
x786Signaller.delayBetweenTwoSameTypeSignals = 6;
|
x786Signaller.delayBetweenTwoSameTypeSignals = 6;
|
||||||
|
|
||||||
//
|
//
|
||||||
// X121 Signaller ...
|
// X121 Signaller ...
|
||||||
X121Signaller *x121Signaller = new X121Signaller();
|
X121Signaller *x121Signaller = new X121Signaller();
|
||||||
x121Signaller.Default();
|
x121Signaller.Default();
|
||||||
x121Signaller.allowLong = x121EAAllowLong;
|
x121Signaller.maxAllowedLong = 0;
|
||||||
x121Signaller.allowShort = x121EAAllowShort;
|
x121Signaller.maxAllowedShort = 0;
|
||||||
|
x121Signaller.allowLong = false; // x121EAAllowLong;
|
||||||
|
x121Signaller.allowShort = false; // x121EAAllowShort;
|
||||||
x121Signaller.maxAllowedOpenPositionAge = 0;
|
x121Signaller.maxAllowedOpenPositionAge = 0;
|
||||||
x121Signaller.minRequiredProfitPerTrade = 1;
|
x121Signaller.minRequiredProfitPerTrade = 0;
|
||||||
x121Signaller.openNextPositionOnProfit = true;
|
x121Signaller.openNextPositionOnProfit = false;
|
||||||
|
x121Signaller.staticVolumeLong = x121EAVolume;
|
||||||
|
x121Signaller.staticVolumeShort = x121EAVolume;
|
||||||
x121Signaller.delayBetweenTwoSameTypeSignals = 6;
|
x121Signaller.delayBetweenTwoSameTypeSignals = 6;
|
||||||
|
|
||||||
//
|
//
|
||||||
// X110 Signaller ...
|
// X110 Signaller ...
|
||||||
X110Signaller *x110Signaller = new X110Signaller();
|
X110Signaller *x110Signaller = new X110Signaller();
|
||||||
x110Signaller.Default();
|
x110Signaller.Default();
|
||||||
|
x110Signaller.maxAllowedLong = 0;
|
||||||
|
x110Signaller.maxAllowedShort = 0;
|
||||||
x110Signaller.allowLong = x121EAAllowLong;
|
x110Signaller.allowLong = x121EAAllowLong;
|
||||||
x110Signaller.allowShort = x121EAAllowShort;
|
x110Signaller.allowShort = x121EAAllowShort;
|
||||||
x110Signaller.maxAllowedOpenPositionAge = 0;
|
x110Signaller.maxAllowedOpenPositionAge = 0;
|
||||||
x110Signaller.minRequiredProfitPerTrade = 1;
|
x110Signaller.minRequiredProfitPerTrade = 0;
|
||||||
x110Signaller.openNextPositionOnProfit = true;
|
x110Signaller.openNextPositionOnProfit = false;
|
||||||
|
x110Signaller.staticVolumeLong = x121EAVolume;
|
||||||
|
x110Signaller.staticVolumeShort = x121EAVolume;
|
||||||
x110Signaller.delayBetweenTwoSameTypeSignals = 6;
|
x110Signaller.delayBetweenTwoSameTypeSignals = 6;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -264,29 +273,67 @@ bool InitialEA()
|
|||||||
x92Signaller.Default();
|
x92Signaller.Default();
|
||||||
x92Signaller.SetSymbol(iSymbol);
|
x92Signaller.SetSymbol(iSymbol);
|
||||||
x92Signaller.SetPeriod(iPeriod);
|
x92Signaller.SetPeriod(iPeriod);
|
||||||
x92Signaller.allowLong = x121EAAllowLong;
|
x92Signaller.maxAllowedLong = 0;
|
||||||
x92Signaller.allowShort = x121EAAllowShort;
|
x92Signaller.maxAllowedShort = 0;
|
||||||
|
x92Signaller.allowLong = false; // x121EAAllowLong;
|
||||||
|
x92Signaller.allowShort = false; // x121EAAllowShort;
|
||||||
x92Signaller.maxAllowedOpenPositionAge = 0;
|
x92Signaller.maxAllowedOpenPositionAge = 0;
|
||||||
x92Signaller.minRequiredProfitPerTrade = 1;
|
x92Signaller.minRequiredProfitPerTrade = 0;
|
||||||
x92Signaller.openNextPositionOnProfit = true;
|
x92Signaller.openNextPositionOnProfit = false;
|
||||||
|
x92Signaller.staticVolumeLong = x121EAVolume;
|
||||||
|
x92Signaller.staticVolumeShort = x121EAVolume;
|
||||||
x92Signaller.delayBetweenTwoSameTypeSignals = 6;
|
x92Signaller.delayBetweenTwoSameTypeSignals = 6;
|
||||||
|
|
||||||
|
//
|
||||||
|
// X128 Signaller ...
|
||||||
|
X128Signaller *x128Signaller = new X128Signaller();
|
||||||
|
x128Signaller.Default();
|
||||||
|
x128Signaller.maxAllowedLong = 0;
|
||||||
|
x128Signaller.maxAllowedShort = 0;
|
||||||
|
x128Signaller.allowLong = false; // x121EAAllowLong;
|
||||||
|
x128Signaller.allowShort = false; // x121EAAllowShort;
|
||||||
|
x128Signaller.maxAllowedOpenPositionAge = 0;
|
||||||
|
x128Signaller.minRequiredProfitPerTrade = 0;
|
||||||
|
x128Signaller.openNextPositionOnProfit = false;
|
||||||
|
x128Signaller.staticVolumeLong = x121EAVolume;
|
||||||
|
x128Signaller.staticVolumeShort = x121EAVolume;
|
||||||
|
x128Signaller.delayBetweenTwoSameTypeSignals = 6;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XSP Signaller ...
|
||||||
|
XSPSignaller *xSPSignaller = new XSPSignaller();
|
||||||
|
xSPSignaller.Default();
|
||||||
|
xSPSignaller.maxAllowedLong = 0;
|
||||||
|
xSPSignaller.maxAllowedShort = 0;
|
||||||
|
xSPSignaller.allowLong = false; // x121EAAllowLong;
|
||||||
|
xSPSignaller.allowShort = false; // x121EAAllowShort;
|
||||||
|
xSPSignaller.maxAllowedOpenPositionAge = 0;
|
||||||
|
xSPSignaller.minRequiredProfitPerTrade = 0;
|
||||||
|
xSPSignaller.openNextPositionOnProfit = false;
|
||||||
|
xSPSignaller.staticVolumeLong = x121EAVolume;
|
||||||
|
xSPSignaller.staticVolumeShort = x121EAVolume;
|
||||||
|
xSPSignaller.delayBetweenTwoSameTypeSignals = 6;
|
||||||
|
|
||||||
//
|
//
|
||||||
Clean(iDescriptor.signallers);
|
Clean(iDescriptor.signallers);
|
||||||
|
|
||||||
//
|
//
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
ArrayResize(iDescriptor.signallers, 4);
|
ArrayResize(iDescriptor.signallers, 1);
|
||||||
|
|
||||||
//
|
//
|
||||||
iDescriptor.signallers[idx] = x786Signaller;
|
// iDescriptor.signallers[idx] = x786Signaller;
|
||||||
idx++;
|
// idx++;
|
||||||
iDescriptor.signallers[idx] = x121Signaller;
|
// iDescriptor.signallers[idx] = x121Signaller;
|
||||||
idx++;
|
// idx++;
|
||||||
iDescriptor.signallers[idx] = x110Signaller;
|
iDescriptor.signallers[idx] = x110Signaller;
|
||||||
idx++;
|
idx++;
|
||||||
iDescriptor.signallers[idx] = x92Signaller;
|
// iDescriptor.signallers[idx] = x92Signaller;
|
||||||
idx++;
|
// idx++;
|
||||||
|
// iDescriptor.signallers[idx] = x128Signaller;
|
||||||
|
// idx++;
|
||||||
|
// iDescriptor.signallers[idx] = xSPSignaller;
|
||||||
|
// idx++;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set Inputs to Default ...
|
// Set Inputs to Default ...
|
||||||
@@ -342,6 +389,11 @@ void ConfigureDescriptor(
|
|||||||
X121ProviderDescriptor &iDescriptor //
|
X121ProviderDescriptor &iDescriptor //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// XASCT ...
|
||||||
|
iDescriptor.inputs.asctInputs.showLongs = false;
|
||||||
|
iDescriptor.inputs.asctInputs.showShorts = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XHK ...
|
// XHK ...
|
||||||
iDescriptor.inputs.hkInputs.drawHikenAshi = false;
|
iDescriptor.inputs.hkInputs.drawHikenAshi = false;
|
||||||
|
|||||||
@@ -0,0 +1,378 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SaherElm IT Center MQL5 Helper Class Library
|
||||||
|
// ----------------------------------------------
|
||||||
|
// Name: XSCXASCTHelper
|
||||||
|
// 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.xhelper.class.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Definitions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
enum ENUM_XASCT_BUFFERS
|
||||||
|
{
|
||||||
|
XASCT_LONG_LINE = 0,
|
||||||
|
XASCT_SHORT_LINE = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Input Models ...
|
||||||
|
struct XASCTInputs
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
//
|
||||||
|
// Market ...
|
||||||
|
int risk; // Risk
|
||||||
|
//
|
||||||
|
// Presentation ...
|
||||||
|
bool showLongs; // Show Long Arrows
|
||||||
|
bool showShorts; // Show Short Arrows
|
||||||
|
uchar longArrowCode; // Long Arrow
|
||||||
|
uchar shortArrowCode; // Short Arrow
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor(s) ...
|
||||||
|
XASCTInputs()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Clean ...
|
||||||
|
void Clean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
risk = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
showLongs = false;
|
||||||
|
showShorts = false;
|
||||||
|
longArrowCode = 0;
|
||||||
|
shortArrowCode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Default ...
|
||||||
|
void Default()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
risk = 4;
|
||||||
|
|
||||||
|
//
|
||||||
|
showLongs = true;
|
||||||
|
showShorts = true;
|
||||||
|
longArrowCode = 233;
|
||||||
|
shortArrowCode = 234;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
bool IsValid()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
risk >= 1
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve MAx Length ...
|
||||||
|
int Max()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = int(MathMax(3 + risk * 2, 4) + 1);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class ...
|
||||||
|
class XSCXASCTHelper : public XSCBaseHelper
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructors ...
|
||||||
|
XSCXASCTHelper() : XSCBaseHelper(_Symbol, _Period)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Deconstructor ...
|
||||||
|
~XSCXASCTHelper() {}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
bool Init(
|
||||||
|
string symbol, // Trading Symbol
|
||||||
|
ENUM_TIMEFRAMES period, // Trading Period
|
||||||
|
XASCTInputs &inputs // Inputs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
mSymbol = symbol;
|
||||||
|
mPeriod = period;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = inputs.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mInputs = inputs;
|
||||||
|
|
||||||
|
//
|
||||||
|
ArraySetAsSeries(longsBuffer, true);
|
||||||
|
ArraySetAsSeries(shortsBuffer, true);
|
||||||
|
mHandler = iCustom(
|
||||||
|
mSymbol,
|
||||||
|
mPeriod,
|
||||||
|
"x-saherelm.xasct",
|
||||||
|
//
|
||||||
|
// Inputs ...
|
||||||
|
//
|
||||||
|
// Market ...
|
||||||
|
"",
|
||||||
|
mInputs.risk, // Risk
|
||||||
|
//
|
||||||
|
// Presentation ...
|
||||||
|
"",
|
||||||
|
mInputs.showLongs, // Show Long Arrows
|
||||||
|
mInputs.showShorts, // Show Short Arrows
|
||||||
|
mInputs.longArrowCode, // Long Arrow
|
||||||
|
mInputs.shortArrowCode // Short Arrow
|
||||||
|
//
|
||||||
|
);
|
||||||
|
result = mHandler != INVALID_HANDLE;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Inputs ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XASCTInputs GetInputs()
|
||||||
|
{
|
||||||
|
return mInputs;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool SetInputs(
|
||||||
|
XASCTInputs &inputs // Configs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return Init(
|
||||||
|
mSymbol,
|
||||||
|
mPeriod,
|
||||||
|
inputs
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Buffers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetLong(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(longsBuffer);
|
||||||
|
if (barIndex >= count)
|
||||||
|
{
|
||||||
|
barIndex = count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return longsBuffer[barIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy Required Items ...
|
||||||
|
int CopyLong(
|
||||||
|
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,
|
||||||
|
longsBuffer,
|
||||||
|
buffer,
|
||||||
|
forceClean
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetShort(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Calculate();
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(shortsBuffer);
|
||||||
|
if (barIndex >= count)
|
||||||
|
{
|
||||||
|
barIndex = count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return shortsBuffer[barIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy Required Items ...
|
||||||
|
int CopyShort(
|
||||||
|
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,
|
||||||
|
shortsBuffer,
|
||||||
|
buffer,
|
||||||
|
forceClean
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
// Private ...
|
||||||
|
private:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
XASCTInputs mInputs; // Inputs ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Buffers ...
|
||||||
|
double longsBuffer[];
|
||||||
|
double shortsBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Values Until Now ...
|
||||||
|
void Calculate()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int totalBars = CountBars();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Longs Buffer ...
|
||||||
|
CopyBuffer(
|
||||||
|
mHandler,
|
||||||
|
XASCT_LONG_LINE,
|
||||||
|
0,
|
||||||
|
totalBars,
|
||||||
|
longsBuffer
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Shorts Buffer ...
|
||||||
|
CopyBuffer(
|
||||||
|
mHandler,
|
||||||
|
XASCT_SHORT_LINE,
|
||||||
|
0,
|
||||||
|
totalBars,
|
||||||
|
shortsBuffer
|
||||||
|
//
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
@@ -0,0 +1,442 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
// SaherElm IT Center MQL5 Indicator
|
||||||
|
// -------------------------------------------
|
||||||
|
// Name: XASCT
|
||||||
|
// Description: XASCTrend Detector ...
|
||||||
|
//
|
||||||
|
// Maintainer:
|
||||||
|
// ------------
|
||||||
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Global Properties ...
|
||||||
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||||
|
#property link "https://saherelm.ir"
|
||||||
|
#property version "1.00"
|
||||||
|
#property description "SaherElm XASCT Indicator"
|
||||||
|
#property strict
|
||||||
|
|
||||||
|
//
|
||||||
|
#define ShortName "XASCT"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Inputs ...
|
||||||
|
|
||||||
|
//
|
||||||
|
input group "Market";
|
||||||
|
input int risk = 4; // Risk
|
||||||
|
|
||||||
|
//
|
||||||
|
input group "Presentation";
|
||||||
|
input bool showLongs = true; // Show Long Arrows
|
||||||
|
input bool showShorts = true; // Show Short Arrows
|
||||||
|
input uchar longArrowCode = 233; // Long Arrow
|
||||||
|
input uchar shortArrowCode = 234; // Short Arrow
|
||||||
|
|
||||||
|
//
|
||||||
|
// Buffers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
#property indicator_chart_window
|
||||||
|
|
||||||
|
//
|
||||||
|
#property indicator_buffers 2
|
||||||
|
#property indicator_plots 2
|
||||||
|
|
||||||
|
//
|
||||||
|
#define longBufferIndex 0
|
||||||
|
double longBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#property indicator_label1 "XASCT Long"
|
||||||
|
#property indicator_type1 DRAW_ARROW
|
||||||
|
#property indicator_color1 clrAqua
|
||||||
|
#property indicator_width1 3
|
||||||
|
|
||||||
|
//
|
||||||
|
#define shortBufferIndex 1
|
||||||
|
double shortBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#property indicator_label2 "XASCT Short"
|
||||||
|
#property indicator_type2 DRAW_ARROW
|
||||||
|
#property indicator_color2 clrMagenta
|
||||||
|
#property indicator_width2 3
|
||||||
|
|
||||||
|
//
|
||||||
|
// Variables ...
|
||||||
|
int maxLength = 0;
|
||||||
|
int wPRHandlers[3];
|
||||||
|
int x1, x2 = 0;
|
||||||
|
int value10, value11 = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// EVENT Handlers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialization ...
|
||||||
|
int OnInit()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Inputs ...
|
||||||
|
if (!ValidateInputs())
|
||||||
|
{
|
||||||
|
return INIT_PARAMETERS_INCORRECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
maxLength = ExtractMaxLengthOfInputs();
|
||||||
|
|
||||||
|
//
|
||||||
|
x1 = 67 + risk;
|
||||||
|
x2 = 33 - risk;
|
||||||
|
value10 = 2;
|
||||||
|
value11 = value10;
|
||||||
|
|
||||||
|
//
|
||||||
|
wPRHandlers[0] = iWPR(_Symbol, _Period, 3);
|
||||||
|
if (wPRHandlers[0] == INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
return INIT_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
wPRHandlers[1] = iWPR(_Symbol, _Period, 4);
|
||||||
|
if (wPRHandlers[1] == INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
return INIT_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
wPRHandlers[2] = iWPR(_Symbol, _Period, 3 + risk * 2);
|
||||||
|
if (wPRHandlers[2] == INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
return INIT_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Define Index Buffers ...
|
||||||
|
DefineBuffers();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set Indicator ShortName ...
|
||||||
|
SetIndicatorName();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Init Succeed ...
|
||||||
|
return INIT_SUCCEEDED;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// DeInitialization ...
|
||||||
|
void OnDeinit(const int reason)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function
|
||||||
|
// REASON_REMOVE 1 Program removed from a chart
|
||||||
|
// REASON_RECOMPILE 2 Program recompiled
|
||||||
|
// REASON_CHARTCHANGE 3 A symbol or a chart period is changed
|
||||||
|
// REASON_CHARTCLOSE 4 Chart closed
|
||||||
|
// REASON_PARAMETERS 5 Inputs changed by a user
|
||||||
|
// REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings
|
||||||
|
// REASON_TEMPLATE 7 Another chart template applied
|
||||||
|
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
|
||||||
|
// REASON_CLOSE 9 Terminal closed
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculating what we want ...
|
||||||
|
int OnCalculate(
|
||||||
|
const int rates_total, // Total Bars on Chart ...
|
||||||
|
const int prev_calculated, // Total Calculated Bars on Charts ...
|
||||||
|
const datetime &time[], // History of Open Time ...
|
||||||
|
const double &open[], // History of Open Price ...
|
||||||
|
const double &high[], // History of High Price ...
|
||||||
|
const double &low[], // History of Low Price ...
|
||||||
|
const double &close[], // History of Close Price ...
|
||||||
|
const long &tick_volume[], // History of Tick Volumes on Bar ...
|
||||||
|
const long &volume[], // History of Trade Volumes ...
|
||||||
|
const int &spread[] // History of Spread Price ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Calculated Bars ...
|
||||||
|
bool isPassedRequiredCalculatedBars =
|
||||||
|
//
|
||||||
|
BarsCalculated(wPRHandlers[0]) == rates_total &&
|
||||||
|
BarsCalculated(wPRHandlers[1]) == rates_total &&
|
||||||
|
BarsCalculated(wPRHandlers[2]) == rates_total
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (!isPassedRequiredCalculatedBars)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Declare Some Local Variables for Use ...
|
||||||
|
int limit, bar, count, iii;
|
||||||
|
double value2, value3, vel = 0, wprs[];
|
||||||
|
double trueCount, range, avgRange, mrO1, mrO2;
|
||||||
|
|
||||||
|
//
|
||||||
|
// checking for the first start of the indicator calculation ...
|
||||||
|
if (prev_calculated > rates_total || prev_calculated <= 0)
|
||||||
|
{
|
||||||
|
limit = rates_total - maxLength;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// starting index for calculation of all bars
|
||||||
|
else
|
||||||
|
{
|
||||||
|
limit = rates_total - prev_calculated;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ArraySetAsSeries(wprs, true);
|
||||||
|
ArraySetAsSeries(open, true);
|
||||||
|
ArraySetAsSeries(high, true);
|
||||||
|
ArraySetAsSeries(low, true);
|
||||||
|
ArraySetAsSeries(close, true);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Main Loop ...
|
||||||
|
for (bar = limit; bar >= 0 && !IsStopped(); bar--)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
range = 0.0;
|
||||||
|
avgRange = 0.0;
|
||||||
|
for (count = bar; count <= bar + 9; count++)
|
||||||
|
{
|
||||||
|
avgRange = avgRange + MathAbs(high[count] - low[count]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
count = bar;
|
||||||
|
trueCount = 0;
|
||||||
|
range = avgRange / 10;
|
||||||
|
|
||||||
|
//
|
||||||
|
while (count < bar + 9 && trueCount < 1)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (MathAbs(open[count] - close[count + 1]) >= range * 2.0)
|
||||||
|
{
|
||||||
|
trueCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (trueCount >= 1)
|
||||||
|
{
|
||||||
|
mrO1 = count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mrO1 = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
count = bar;
|
||||||
|
trueCount = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
while (count < bar + 6 && trueCount < 1)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (MathAbs(close[count + 3] - close[count]) >= range * 4.6)
|
||||||
|
{
|
||||||
|
trueCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (trueCount >= 1)
|
||||||
|
{
|
||||||
|
mrO2 = count;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mrO2 = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (mrO1 > -1)
|
||||||
|
{
|
||||||
|
value11 = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value11 = value10;
|
||||||
|
}
|
||||||
|
if (mrO2 > -1)
|
||||||
|
{
|
||||||
|
value11 = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value11 = value10;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (CopyBuffer(wPRHandlers[value11], 0, bar, 1, wprs) <= 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
value2 = 100 - MathAbs(wprs[0]);
|
||||||
|
|
||||||
|
//
|
||||||
|
longBuffer[bar] = 0;
|
||||||
|
shortBuffer[bar] = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
value3 = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (value2 < x2)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iii = 1;
|
||||||
|
while (bar + iii < rates_total)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (CopyBuffer(wPRHandlers[value11], 0, bar + iii, 1, wprs) <= 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
vel = 100 - MathAbs(wprs[0]);
|
||||||
|
if (vel >= x2 && vel <= x1)
|
||||||
|
{
|
||||||
|
iii++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (vel > x1)
|
||||||
|
{
|
||||||
|
value3 = high[bar] + range * 0.5;
|
||||||
|
shortBuffer[bar] = value3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (value2 > x1)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iii = 1;
|
||||||
|
while (bar + iii < rates_total)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (CopyBuffer(wPRHandlers[value11], 0, bar + iii, 1, wprs) <= 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
vel = 100 - MathAbs(wprs[0]);
|
||||||
|
if (vel >= x2 && vel <= x1)
|
||||||
|
{
|
||||||
|
iii++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (vel < x2)
|
||||||
|
{
|
||||||
|
value3 = low[bar] - range * 0.5;
|
||||||
|
longBuffer[bar] = value3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return rates_total;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// CUSTOM Functions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Input Args for Initialization ...
|
||||||
|
bool ValidateInputs()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
risk >= 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve all Exists Input Max Length ...
|
||||||
|
// use for Start Of Drawing ...
|
||||||
|
int ExtractMaxLengthOfInputs()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = int(MathMax(3 + risk * 2, 4) + 1);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set Indicator Short Name and also we can define Buffers Labels ...
|
||||||
|
void SetIndicatorName()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
IndicatorSetInteger(INDICATOR_DIGITS, _Digits);
|
||||||
|
IndicatorSetString(INDICATOR_SHORTNAME, ShortName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Define Indexes and Styles ...
|
||||||
|
void DefineBuffers()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Longs Buffer ...
|
||||||
|
ENUM_DRAW_TYPE longsDrawType = showLongs ? DRAW_ARROW : DRAW_NONE;
|
||||||
|
ArraySetAsSeries(longBuffer, true);
|
||||||
|
SetIndexBuffer(longBufferIndex, longBuffer, INDICATOR_DATA);
|
||||||
|
PlotIndexSetDouble(longBufferIndex, PLOT_EMPTY_VALUE, 0);
|
||||||
|
PlotIndexSetInteger(longBufferIndex, PLOT_DRAW_BEGIN, maxLength);
|
||||||
|
PlotIndexSetInteger(longBufferIndex, PLOT_SHOW_DATA, showLongs);
|
||||||
|
PlotIndexSetInteger(longBufferIndex, PLOT_DRAW_TYPE, longsDrawType);
|
||||||
|
PlotIndexSetInteger(longBufferIndex, PLOT_ARROW, longArrowCode);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Short Buffer ...
|
||||||
|
ENUM_DRAW_TYPE shortsDrawType = showShorts ? DRAW_ARROW : DRAW_NONE;
|
||||||
|
ArraySetAsSeries(shortBuffer, true);
|
||||||
|
SetIndexBuffer(shortBufferIndex, shortBuffer, INDICATOR_DATA);
|
||||||
|
PlotIndexSetDouble(shortBufferIndex, PLOT_EMPTY_VALUE, 0);
|
||||||
|
PlotIndexSetInteger(shortBufferIndex, PLOT_DRAW_BEGIN, maxLength);
|
||||||
|
PlotIndexSetInteger(shortBufferIndex, PLOT_SHOW_DATA, showShorts);
|
||||||
|
PlotIndexSetInteger(shortBufferIndex, PLOT_DRAW_TYPE, shortsDrawType);
|
||||||
|
PlotIndexSetInteger(shortBufferIndex, PLOT_ARROW, shortArrowCode);
|
||||||
|
}
|
||||||
@@ -54,9 +54,9 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool HasLongConditions(
|
bool HasLongConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -73,6 +73,14 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double bullishScore = 0;
|
||||||
|
double bearishScore = 0;
|
||||||
|
conditions.GenerateScore(
|
||||||
|
bullishScore,
|
||||||
|
bearishScore //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isCloseOverSenkouSpanA = conditions.bars[1].close > conditions.ichSenkouSpanAs[1];
|
bool isCloseOverSenkouSpanA = conditions.bars[1].close > conditions.ichSenkouSpanAs[1];
|
||||||
|
|
||||||
@@ -148,22 +156,29 @@ public:
|
|||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
condition1
|
// condition1
|
||||||
//
|
// //
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
condition2
|
// condition2
|
||||||
//
|
// //
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
condition3
|
condition3
|
||||||
//
|
// //
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
condition4
|
// condition4
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
result =
|
||||||
|
bullishScore > bearishScore;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
@@ -176,9 +191,9 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool HasShortConditions(
|
bool HasShortConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -195,6 +210,14 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double bullishScore = 0;
|
||||||
|
double bearishScore = 0;
|
||||||
|
conditions.GenerateScore(
|
||||||
|
bullishScore,
|
||||||
|
bearishScore //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isCloseUnderSenkouSpanB = conditions.bars[1].close < conditions.ichSenkouSpanBs[1];
|
bool isCloseUnderSenkouSpanB = conditions.bars[1].close < conditions.ichSenkouSpanBs[1];
|
||||||
|
|
||||||
@@ -270,22 +293,29 @@ public:
|
|||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
condition1
|
// condition1
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
condition2
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
//
|
||||||
|
// ||
|
||||||
|
// //
|
||||||
|
// condition2
|
||||||
|
// //
|
||||||
|
// ||
|
||||||
|
// //
|
||||||
condition3
|
condition3
|
||||||
//
|
// //
|
||||||
||
|
// ||
|
||||||
//
|
// //
|
||||||
condition4
|
// condition4
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
result =
|
||||||
|
bearishScore > bullishScore ;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool HasLongConditions(
|
bool HasLongConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -110,9 +110,9 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool HasShortConditions(
|
bool HasShortConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SaherElm IT Center MQL5 Class Library
|
||||||
|
// ----------------------------------------------
|
||||||
|
// Name: X128Signaller
|
||||||
|
// Description: Signalling using X121 rules ...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// 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 "../Libraries/x-saherelm.xtrade.lib.mq5"
|
||||||
|
#include "../Classes/x-saherelm.x121.xmcycle.class.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Definitions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class ...
|
||||||
|
class X128Signaller : public XSignallerDescriptor
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor(s) ...
|
||||||
|
void X128Signaller()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
name = X128;
|
||||||
|
Default();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Deconstructor ...
|
||||||
|
void ~X128Signaller() {}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Override(s) ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasLongConditions(
|
||||||
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
|
double &sl, // Hold SL ...
|
||||||
|
double &tp // Hold TP ...
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = 0;
|
||||||
|
tp = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = allowLong;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
false
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
sl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasShortConditions(
|
||||||
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
|
double &sl, // Hold SL ...
|
||||||
|
double &tp // Hold TP ...
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = 0;
|
||||||
|
tp = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = allowLong;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
false
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
sl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double lastPeakOnPeakTouched;
|
||||||
|
double lastValeOnPeakTouched;
|
||||||
|
datetime lastTouchedPeak;
|
||||||
|
|
||||||
|
//
|
||||||
|
double lastPeakOnValeTouched;
|
||||||
|
double lastValeOnValeTouched;
|
||||||
|
datetime lastTouchedVale;
|
||||||
|
};
|
||||||
@@ -54,11 +54,11 @@ public:
|
|||||||
// Override(s) ...
|
// Override(s) ...
|
||||||
|
|
||||||
//
|
//
|
||||||
virtual bool HasLongConditions(
|
bool HasLongConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
)
|
) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@@ -116,11 +116,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
virtual bool HasShortConditions(
|
bool HasShortConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
)
|
) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool HasLongConditions(
|
bool HasLongConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -153,9 +153,9 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool HasShortConditions(
|
bool HasShortConditions(
|
||||||
const X121MCycleConditions &conditions, // Market Conditions
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
double &sl, // Hold SL ...
|
double &sl, // Hold SL ...
|
||||||
double &tp // Hold TP ...
|
double &tp // Hold TP ...
|
||||||
) override
|
) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SaherElm IT Center MQL5 Class Library
|
||||||
|
// ----------------------------------------------
|
||||||
|
// Name: XSPSignaller
|
||||||
|
// Description: Signalling using X121 rules ...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// 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 "../Libraries/x-saherelm.xtrade.lib.mq5"
|
||||||
|
#include "../Classes/x-saherelm.x121.xmcycle.class.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Definitions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Class ...
|
||||||
|
class XSPSignaller : public XSignallerDescriptor
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor(s) ...
|
||||||
|
void XSPSignaller()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
name = XSP;
|
||||||
|
Default();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Deconstructor ...
|
||||||
|
void ~XSPSignaller() {}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Override(s) ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasLongConditions(
|
||||||
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
|
double &sl, // Hold SL ...
|
||||||
|
double &tp // Hold TP ...
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = 0;
|
||||||
|
tp = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = allowLong;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
false
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
sl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasShortConditions(
|
||||||
|
X121MCycleConditions &conditions, // Market Conditions
|
||||||
|
double &sl, // Hold SL ...
|
||||||
|
double &tp // Hold TP ...
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = 0;
|
||||||
|
tp = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = allowLong;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
false
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
sl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user