add hull and sslc into x121 market ...

This commit is contained in:
2024-06-04 19:41:18 +03:30
parent 0b3587431f
commit ae4c98c601
7 changed files with 245 additions and 52 deletions
+48 -10
View File
@@ -27,15 +27,17 @@
#include "../Helpers/x-saherelm.xcc.helper.mq5"
#include "../Helpers/x-saherelm.xct.helper.mq5"
#include "../Helpers/x-saherelm.xmc.helper.mq5"
#include "../Helpers/x-saherelm.xdon.helper.mq5"
#include "../Helpers/x-saherelm.xzg.helper.mq5"
#include "../Helpers/x-saherelm.xpv.helper.mq5"
#include "../Helpers/x-saherelm.xtm.helper.mq5"
#include "../Helpers/x-saherelm.xtd.helper.mq5"
#include "../Helpers/x-saherelm.xdon.helper.mq5"
#include "../Helpers/x-saherelm.xstr.helper.mq5"
#include "../Helpers/x-saherelm.xche.helper.mq5"
#include "../Helpers/x-saherelm.xosc.helper.mq5"
#include "../Helpers/x-saherelm.xtm.helper.mq5"
#include "../Helpers/x-saherelm.xama.helper.mq5"
#include "../Helpers/x-saherelm.xtd.helper.mq5"
#include "../Helpers/x-saherelm.xhull.helper.mq5"
#include "../Helpers/x-saherelm.xsslc.helper.mq5"
//
#include "../Classes/x-saherelm.xprovider.class.mq5"
@@ -99,6 +101,8 @@ public:
XSTRInputs strInputs;
XDONInputs donInputs;
XOSCInputs oscInputs;
XHULLInputs hullInputs;
XSSLCInputs sslcInputs;
//
X121MCycleInputs cMarketInputs; // Curent Market Inputs
@@ -175,8 +179,14 @@ public:
{
ichInputs.Default();
}
//
if (!hullInputs.IsValid())
{
hullInputs.Default();
}
if (!sslcInputs.IsValid())
{
sslcInputs.Default();
}
if (!tdInputs.IsValid())
{
tdInputs.Default();
@@ -198,6 +208,8 @@ public:
cMarketInputs.cheInputs = this.cheInputs;
cMarketInputs.ichInputs = this.ichInputs;
cMarketInputs.donInputs = this.donInputs;
cMarketInputs.hullInputs = this.hullInputs;
cMarketInputs.sslcInputs = this.sslcInputs;
result = cMarketInputs.Init(
this.symbol,
this.period,
@@ -225,6 +237,8 @@ public:
sMarketInputs.cheInputs = this.cheInputs;
sMarketInputs.ichInputs = this.ichInputs;
sMarketInputs.donInputs = this.donInputs;
sMarketInputs.hullInputs = this.hullInputs;
sMarketInputs.sslcInputs = this.sslcInputs;
result = sMarketInputs.Init(
this.symbol,
this.period,
@@ -252,6 +266,8 @@ public:
mMarketInputs.cheInputs = this.cheInputs;
mMarketInputs.ichInputs = this.ichInputs;
mMarketInputs.donInputs = this.donInputs;
mMarketInputs.hullInputs = this.hullInputs;
mMarketInputs.sslcInputs = this.sslcInputs;
result = mMarketInputs.Init(
this.symbol,
this.period,
@@ -279,6 +295,8 @@ public:
lMarketInputs.cheInputs = this.cheInputs;
lMarketInputs.ichInputs = this.ichInputs;
lMarketInputs.donInputs = this.donInputs;
lMarketInputs.hullInputs = this.hullInputs;
lMarketInputs.sslcInputs = this.sslcInputs;
result = lMarketInputs.Init(
this.symbol,
this.period,
@@ -306,6 +324,8 @@ public:
hMarketInputs.cheInputs = this.cheInputs;
hMarketInputs.ichInputs = this.ichInputs;
hMarketInputs.donInputs = this.donInputs;
hMarketInputs.hullInputs = this.hullInputs;
hMarketInputs.sslcInputs = this.sslcInputs;
result = hMarketInputs.Init(
this.symbol,
this.period,
@@ -351,13 +371,15 @@ public:
pvInputs.IsValid() &&
mcInputs.IsValid() &&
hkInputs.IsValid() &&
tdInputs.IsValid() &&
mrbInputs.IsValid() &&
cheInputs.IsValid() &&
strInputs.IsValid() &&
donInputs.IsValid() &&
oscInputs.IsValid() &&
ichInputs.IsValid() &&
tdInputs.IsValid() &&
hullInputs.IsValid() &&
sslcInputs.IsValid() &&
//
cMarketInputs.IsValid() &&
sMarketInputs.IsValid() &&
@@ -406,14 +428,15 @@ public:
pvInputs.Clean();
mcInputs.Clean();
hkInputs.Clean();
tdInputs.Clean();
mrbInputs.Clean();
cheInputs.Clean();
strInputs.Clean();
donInputs.Clean();
oscInputs.Clean();
ichInputs.Clean();
//
tdInputs.Clean();
hullInputs.Clean();
sslcInputs.Clean();
//
cMarketInputs.Clean();
sMarketInputs.Clean();
@@ -457,13 +480,15 @@ public:
pvInputs.Default();
mcInputs.Default();
hkInputs.Default();
tdInputs.Default();
mrbInputs.Default();
cheInputs.Default();
strInputs.Default();
donInputs.Default();
oscInputs.Default();
ichInputs.Default();
tdInputs.Default();
hullInputs.Default();
sslcInputs.Default();
//
cMarketInputs.Default();
@@ -487,6 +512,18 @@ public:
result = MathMax(result, ctInputs.Max());
result = MathMax(result, ccInputs.Max());
result = MathMax(result, tdInputs.Max());
result = MathMax(result, zgInputs.Max());
result = MathMax(result, pvInputs.Max());
result = MathMax(result, mcInputs.Max());
result = MathMax(result, hkInputs.Max());
result = MathMax(result, mrbInputs.Max());
result = MathMax(result, cheInputs.Max());
result = MathMax(result, strInputs.Max());
result = MathMax(result, donInputs.Max());
result = MathMax(result, oscInputs.Max());
result = MathMax(result, ichInputs.Max());
result = MathMax(result, hullInputs.Max());
result = MathMax(result, sslcInputs.Max());
//
return result;
@@ -1292,7 +1329,8 @@ struct X121ProviderDescriptor
//
// Check Waits Until New Bar ...
result = !this.provider.CanIgnoreProcess();
if (!result) {
if (!result)
{
return result;
}
@@ -1,188 +0,0 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Class Library
// ----------------------------------------------
// Name: X121Signaller
// 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 X121Signaller : public XSignallerDescriptor
{
//
// Public ...
public:
//
// Props ...
//
// Constructor(s) ...
void X121Signaller()
{
name = X121;
Default();
}
//
// Deconstructor ...
void ~X121Signaller() {}
//
// Override(s) ...
//
bool HasLongConditions(
const X121MCycleConditions &conditions, // Market Conditions
double &sl, // Hold SL ...
double &tp // Hold TP ...
) override
{
//
bool result = false;
//
sl = 0;
tp = 0;
//
result = enableLong;
if (!result)
{
return result;
}
//
result =
//
(conditions.isMRBFastCrossedOverSlow &&
(conditions.isCHEBullish &&
conditions.isTrendBullish &&
conditions.isMCFastOverSlow))
//
||
//
(conditions.isMRBSlowCrossedtOverVerifier &&
(conditions.isCHEBullish &&
conditions.isTrendBullish &&
conditions.isMCFastOverSlow &&
conditions.isMRBFastOverSlow))
//
||
//
(conditions.isCHESwitchedToBullish &&
(conditions.isTrendBullish &&
conditions.isMCFastOverSlow &&
conditions.isMRBFastOverSlow))
//
;
//
if (result)
{
sl = conditions.mrbSlows[1];
}
//
return result;
}
//
bool HasShortConditions(
const X121MCycleConditions &conditions, // Market Conditions
double &sl, // Hold SL ...
double &tp // Hold TP ...
) override
{
//
bool result = false;
//
sl = 0;
tp = 0;
//
result = enableShort;
if (!result)
{
return result;
}
//
result =
//
(conditions.isSMHKSwitchedToBearish &&
(conditions.isTDBearish &&
conditions.isCHEBearish &&
conditions.isTrendBearish))
//
||
//
(conditions.isTDSwitchedToBearish &&
(conditions.isSMHKBearish &&
conditions.isCHEBearish &&
conditions.isTrendBearish))
//
||
//
(conditions.isCHESwitchedToBearish &&
(conditions.isTDBearish &&
conditions.isSMHKBearish &&
conditions.isTrendBearish))
//
||
//
(conditions.isTrendSwitchedToBearish &&
(conditions.isTDBearish &&
conditions.isCHEBearish &&
conditions.isSMHKBearish))
//
;
//
if (result)
{
sl = conditions.mrbFasts[1];
}
//
return result;
}
//
// Tools ...
void Default()
{
//
enableLong = true;
enableShort = true;
//
r2r = 1;
//
staticVolumeLong = 0.01;
staticVolumeShort = 0.01;
}
};
@@ -1,193 +0,0 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Class Library
// ----------------------------------------------
// Name: X786Signaller
// Description: Signalling using X786 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 X786Signaller : public XSignallerDescriptor
{
//
// Public ...
public:
//
// Props ...
//
// Constructor(s) ...
void X786Signaller()
{
//
name = X786;
Default();
}
//
// Deconstructor ...
void ~X786Signaller() {}
//
// Override(s) ...
//
virtual bool HasLongConditions(
const X121MCycleConditions &conditions, // Market Conditions
double &sl, // Hold SL ...
double &tp // Hold TP ...
)
{
//
bool result = false;
//
sl = 0;
tp = 0;
//
result = enableLong;
if (!result)
{
return result;
}
//
result =
//
(conditions.isSMHKSwitchedToBullish &&
(conditions.isTDBullish &&
conditions.isCHEBullish &&
conditions.isTrendBullish))
//
||
//
(conditions.isTDSwitchedToBullish &&
(conditions.isSMHKBullish &&
conditions.isCHEBullish &&
conditions.isTrendBullish))
//
||
//
(conditions.isCHESwitchedToBullish &&
(conditions.isTDBullish &&
conditions.isSMHKBullish &&
conditions.isTrendBullish))
//
||
//
(conditions.isTrendSwitchedToBullish &&
(conditions.isTDBullish &&
conditions.isCHEBullish &&
conditions.isSMHKBullish))
//
;
//
if (result) {
sl = conditions.donLowerHs[1];
}
//
return result;
}
//
virtual bool HasShortConditions(
const X121MCycleConditions &conditions, // Market Conditions
double &sl, // Hold SL ...
double &tp // Hold TP ...
)
{
//
bool result = false;
//
result = enableShort;
if (!result)
{
return result;
}
//
tp = 0;
sl = 0;
//
result =
//
(conditions.isSMHKSwitchedToBearish &&
(conditions.isTDBearish &&
conditions.isCHEBearish &&
conditions.isTrendBearish))
//
||
//
(conditions.isTDSwitchedToBearish &&
(conditions.isSMHKBearish &&
conditions.isCHEBearish &&
conditions.isTrendBearish))
//
||
//
(conditions.isCHESwitchedToBearish &&
(conditions.isTDBearish &&
conditions.isSMHKBearish &&
conditions.isTrendBearish))
//
||
//
(conditions.isTrendSwitchedToBearish &&
(conditions.isTDBearish &&
conditions.isCHEBearish &&
conditions.isSMHKBearish))
//
;
//
if (result) {
sl = conditions.donUpperLs[1];
}
//
return result;
}
//
// Tools ...
void Default()
{
//
enableLong = true;
enableShort = true;
//
r2r = 1;
//
staticVolumeLong = 0.01;
staticVolumeShort = 0.01;
}
};
+145 -11
View File
@@ -38,6 +38,8 @@
#include "../Helpers/x-saherelm.xosc.helper.mq5"
#include "../Helpers/x-saherelm.xstr.helper.mq5"
#include "../Helpers/x-saherelm.xich.helper.mq5"
#include "../Helpers/x-saherelm.xhull.helper.mq5"
#include "../Helpers/x-saherelm.xsslc.helper.mq5"
//
#include "../Libraries/x-saherelm.xtrade.lib.mq5"
@@ -165,17 +167,19 @@ public:
bool drawPBarMid; // Draw Previous Bar Mid Line
//
XHKInputs hkInputs; // HK Inputs ...
XMCInputs mcInputs; // MC Inputs ...
XPVInputs pvInputs; // PV Inputs ...
XZGInputs zgInputs; // ZG Inputs ...
XTDInputs tdInputs; // TD Inputs ...
XMRBInputs mrbInputs; // MRB Inputs ...
XSTRInputs strInputs; // STR Inputs ...
XOSCInputs oscInputs; // OSC Inputs ...
XCHEInputs cheInputs; // CHE Inputs ...
XICHInputs ichInputs; // ICH Inputs ...
XDONInputs donInputs; // DON Inputs ...
XHKInputs hkInputs; // HK Inputs ...
XMCInputs mcInputs; // MC Inputs ...
XPVInputs pvInputs; // PV Inputs ...
XZGInputs zgInputs; // ZG Inputs ...
XTDInputs tdInputs; // TD Inputs ...
XMRBInputs mrbInputs; // MRB Inputs ...
XSTRInputs strInputs; // STR Inputs ...
XOSCInputs oscInputs; // OSC Inputs ...
XCHEInputs cheInputs; // CHE Inputs ...
XICHInputs ichInputs; // ICH Inputs ...
XDONInputs donInputs; // DON Inputs ...
XHULLInputs hullInputs; // HULL Inputs ...
XSSLCInputs sslcInputs; // SSLC Inputs ...
//
// Constructor ...
@@ -230,6 +234,8 @@ public:
cheInputs.Default();
ichInputs.Default();
donInputs.Default();
hullInputs.Default();
sslcInputs.Default();
}
//
@@ -260,6 +266,8 @@ public:
XCHEInputs &mCheInputs, // CHE Inputs
XICHInputs &mIchInputs, // ICH Inputs ...
XDONInputs &mDonInputs, // DON Inputs ...
XHULLInputs &mHullInputs, // HULL Inputs ...
XSSLCInputs &mSslcInputs, // SSLC Inputs ...
int mHostBarIndex = 0, // Specified Host Period Bar Index
string mPrefix = "" // Prefix
)
@@ -293,6 +301,8 @@ public:
cheInputs = mCheInputs;
ichInputs = mIchInputs;
donInputs = mDonInputs;
hullInputs = mHullInputs;
sslcInputs = mSslcInputs;
//
result = IsValid();
@@ -324,6 +334,8 @@ public:
cheInputs.Clean();
ichInputs.Clean();
donInputs.Clean();
hullInputs.Clean();
sslcInputs.Clean();
//
cBarDrawSpecs.Clean();
@@ -355,6 +367,8 @@ public:
cheInputs.Default();
ichInputs.Default();
donInputs.Default();
hullInputs.Default();
sslcInputs.Default();
//
drawLabels = false;
@@ -455,6 +469,20 @@ public:
return result;
}
//
result = hullInputs.IsValid();
if (!result)
{
return result;
}
//
result = sslcInputs.IsValid();
if (!result)
{
return result;
}
//
return result;
}
@@ -481,6 +509,8 @@ public:
result = MathMax(result, cheInputs.Max());
result = MathMax(result, ichInputs.Max());
result = MathMax(result, donInputs.Max());
result = MathMax(result, hullInputs.Max());
result = MathMax(result, sslcInputs.Max());
//
return result;
@@ -554,6 +584,16 @@ public:
double zigzags[];
double zigzagPVs[];
//
// XHULL ...
double hullUps[];
double hullDowns[];
//
// XSSLC ...
double sslcUps[];
double sslcDowns[];
//
// XMRB ...
@@ -645,6 +685,12 @@ public:
bool isZigZagInPeak;
bool isZigZagInVale;
//
// XHULL ...
//
// XSSLC ...
//
// XPV ...
@@ -986,6 +1032,10 @@ public:
Clean(tdBullishs);
Clean(tdBearishs);
Clean(tdSignals);
Clean(hullUps);
Clean(hullDowns);
Clean(sslcUps);
Clean(sslcDowns);
//
// Buffers ...
@@ -1067,12 +1117,22 @@ public:
ArraySetAsSeries(tdBullishs, true);
ArraySetAsSeries(tdBearishs, true);
ArraySetAsSeries(tdSignals, true);
ArraySetAsSeries(hullUps, true);
ArraySetAsSeries(hullDowns, true);
ArraySetAsSeries(sslcUps, true);
ArraySetAsSeries(sslcDowns, true);
//
// XZG ...
isZigZagInPeak = false;
isZigZagInVale = false;
//
// XHULL ...
//
// XSSLC ...
//
// XPV ...
@@ -1358,6 +1418,12 @@ public:
bearScore++;
}
//
// XHULL ...
//
// XSSLC ...
//
// XPV ...
@@ -2633,6 +2699,8 @@ public:
XSCXOSCHelper osc;
XSCXICHHelper ich;
XSCXDONHelper don;
XSCXHULLHelper hull;
XSCXSSLCHelper sslc;
//
// Properties ...
@@ -2794,6 +2862,40 @@ public:
//
// Filling Buffers ...
//
// XHULL ...
//
hull.CopyUp(
start,
count,
conditions.hullUps //
);
//
hull.CopyDown(
start,
count,
conditions.hullDowns //
);
//
// XSSLC ...
//
sslc.CopyUp(
start,
count,
conditions.sslcUps //
);
//
sslc.CopyDown(
start,
count,
conditions.sslcDowns //
);
//
// XHK ...
@@ -3512,6 +3614,12 @@ public:
bool isSMHKSwitchedToBullish = cSMHKBar.IsBullish() && !pSMHKBar.IsBullish();
bool isSMHKSwitchedToBearish = cSMHKBar.IsBearish() && !pSMHKBar.IsBearish();
//
// XHULL ...
//
// XSSLC ...
//
// XICH ...
@@ -4355,6 +4463,32 @@ public:
//
// Init Helpers ...
//
// XHULL ...
result = hull.Init(
symbol,
period,
mInputs.hullInputs
//
);
if (!result)
{
return result;
}
//
// XSSLC ...
result = sslc.Init(
symbol,
period,
mInputs.sslcInputs
//
);
if (!result)
{
return result;
}
//
// XHK ...
result = hk.Init(