From 179efd4170510f9ddc29bc9b6e079d9655ccc2a9 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Tue, 28 May 2024 19:25:53 +0330 Subject: [PATCH] complete X786 ... --- Classes/x-saherelm.x121.provider.class.mq5 | 672 +++---------- Classes/x-saherelm.x121.xea.class.mq5 | 18 +- Classes/x-saherelm.x121.xmcycle.class.mq5 | 1013 ++++++++++++++++++++ Documents/BKP/SingallingXTDNew.mq5 | 415 ++++++++ Experts/x-test.x121ea.mq5 | 14 +- 5 files changed, 1579 insertions(+), 553 deletions(-) create mode 100644 Documents/BKP/SingallingXTDNew.mq5 diff --git a/Classes/x-saherelm.x121.provider.class.mq5 b/Classes/x-saherelm.x121.provider.class.mq5 index 207f8b54..8d165617 100644 --- a/Classes/x-saherelm.x121.provider.class.mq5 +++ b/Classes/x-saherelm.x121.provider.class.mq5 @@ -265,6 +265,7 @@ public: // Current ... cMarketInputs.pvInputs = this.pvInputs; cMarketInputs.zgInputs = this.zgInputs; + cMarketInputs.tdInputs = this.tdInputs; cMarketInputs.mcInputs = this.mcInputs; cMarketInputs.hkInputs = this.hkInputs; cMarketInputs.mrbInputs = this.mrbInputs; @@ -291,6 +292,7 @@ public: // Short ... sMarketInputs.pvInputs = this.pvInputs; sMarketInputs.zgInputs = this.zgInputs; + sMarketInputs.tdInputs = this.tdInputs; sMarketInputs.mcInputs = this.mcInputs; sMarketInputs.hkInputs = this.hkInputs; sMarketInputs.mrbInputs = this.mrbInputs; @@ -317,6 +319,7 @@ public: // Medium ... mMarketInputs.pvInputs = this.pvInputs; mMarketInputs.zgInputs = this.zgInputs; + mMarketInputs.tdInputs = this.tdInputs; mMarketInputs.mcInputs = this.mcInputs; mMarketInputs.hkInputs = this.hkInputs; mMarketInputs.mrbInputs = this.mrbInputs; @@ -343,6 +346,7 @@ public: // Long ... lMarketInputs.pvInputs = this.pvInputs; lMarketInputs.zgInputs = this.zgInputs; + lMarketInputs.tdInputs = this.tdInputs; lMarketInputs.mcInputs = this.mcInputs; lMarketInputs.hkInputs = this.hkInputs; lMarketInputs.mrbInputs = this.mrbInputs; @@ -369,6 +373,7 @@ public: // Hind ... hMarketInputs.pvInputs = this.pvInputs; hMarketInputs.zgInputs = this.zgInputs; + hMarketInputs.tdInputs = this.tdInputs; hMarketInputs.mcInputs = this.mcInputs; hMarketInputs.hkInputs = this.hkInputs; hMarketInputs.mrbInputs = this.mrbInputs; @@ -3091,17 +3096,19 @@ public: ? entry - risk : entry + risk; } - - // - // TODOO: Remove this ... - sl = hasLong - ? sMarket.pv.GetMCLL(0) - : sMarket.pv.GetMCHH(0); - double risk = MathAbs(entry - sl); - double reward = risk * r2r; - tp = hasLong - ? entry + reward - : entry - reward; + else + { + // + // TODOO: Remove this ... + sl = hasLong + ? sMarket.pv.GetMCLL(0) + : sMarket.pv.GetMCHH(0); + double risk = MathAbs(entry - sl); + double reward = risk * r2r; + tp = hasLong + ? entry + reward + : entry - reward; + } // result = mSignal.Prepare( @@ -7570,422 +7577,6 @@ private: // bool result = false; - // - // XSTR - // XPV - // XHK - // XCHE - // XTD - // XDON - - // - // Conditions ... - // - [] XPV,XDON: XPV Vale and XDON LL (Low Lower) must be same; - // - [] XDON: Candle Crossed Down XDON HL (High Lower); - // - [] XDON: Candle Crossed Up XDON HL (High Lower); - // - [] XTD: When Candle Crossed Up XTD Must in Bullish Mode; - // - [] XCHE: Check CHE Long Exits Exists; - // - [] XSTR: Check STR Trend is Bullish; - // - [] XPV: Not In Fibo Section Changed; - // - [] XPV: Fibo Level 5 Crossed Using Don HL Crosser Cndle; - - // - int zIndex = 0; - int cIndex = zIndex + 1; - int pIndex = cIndex + 1; - - // - // XSTR ... - ENUM_XSTR_TREND_STATES cStrState = cMarket - .str - .GetState(cIndex); - double cStrTrend = cMarket.str.GetTrend(cIndex); - bool isCStrBullish = cStrState == X_STR_BULLISH; - bool isCStrBearish = cStrState == X_STR_BEARISH; - - // - ENUM_XSTR_TREND_STATES pStrState = cMarket - .str - .GetState(pIndex); - double pStrTrend = cMarket.str.GetTrend(pIndex); - bool isPStrBullish = pStrState == X_STR_BULLISH; - bool isPStrBearish = pStrState == X_STR_BEARISH; - - // - bool isTrendBullish = isCStrBullish; - bool isTrendBearish = isCStrBearish; - - // - bool isTrendSwitchedToBullish = - // - isCStrBullish && - !isPStrBullish - // - ; - - // - bool isTrendSwitchedToBearish = - // - isCStrBearish && - !isPStrBearish - // - ; - - // - // XCHE ... - - // - double cCHELongExit1 = cMarket.che.GetLongExit1(cIndex); - double cCHELongExit2 = cMarket.che.GetLongExit2(cIndex); - - // - double pCHELongExit1 = cMarket.che.GetLongExit1(pIndex); - double pCHELongExit2 = cMarket.che.GetLongExit2(pIndex); - - // - double cCHEShortExit1 = cMarket.che.GetShortExit1(cIndex); - double cCHEShortExit2 = cMarket.che.GetShortExit2(cIndex); - - // - double pCHEShortExit1 = cMarket.che.GetShortExit1(pIndex); - double pCHEShortExit2 = cMarket.che.GetShortExit2(pIndex); - - // - bool CCHEHasLongExit1 = NotEmpty(cCHELongExit1); - bool CCHEHasLongExit2 = NotEmpty(cCHELongExit2); - - // - bool CCHEHasShortExit1 = NotEmpty(cCHEShortExit1); - bool CCHEHasShortExit2 = NotEmpty(cCHEShortExit2); - - // - bool PCHEHasLongExit1 = NotEmpty(pCHELongExit1); - bool PCHEHasLongExit2 = NotEmpty(pCHELongExit2); - - // - bool PCHEHasShortExit1 = NotEmpty(pCHEShortExit1); - bool PCHEHasShortExit2 = NotEmpty(pCHEShortExit2); - - // - bool isCCHEBullish = - // - CCHEHasLongExit1 && - CCHEHasLongExit2 - // - ; - - // - bool isCCHEBearish = - // - CCHEHasShortExit1 && - CCHEHasShortExit2 - // - ; - - // - bool isPCHEBullish = - // - PCHEHasLongExit1 && - PCHEHasLongExit2 - // - ; - - // - bool isPCHEBearish = - // - PCHEHasShortExit1 && - PCHEHasShortExit2 - // - ; - - // - bool isCHEBullish = isCCHEBullish; - bool isCHEBearish = isCCHEBearish; - bool isCHESwitchedToBullish = - // - isCCHEBullish && - !isPCHEBullish - // - ; - bool isCHESwitchedToBearish = - // - isCCHEBearish && - !isPCHEBearish - // - ; - - // - // XPV ... - - double cPVPeak = cMarket.pv.GetPeak(cIndex); - double cPVVale = cMarket.pv.GetVale(cIndex); - - // - double pPVPeak = cMarket.pv.GetPeak(pIndex); - double pPVVale = cMarket.pv.GetVale(pIndex); - - // - double cPVSup = cMarket.pv.GetSupport(cIndex); - double pPVSup = cMarket.pv.GetSupport(pIndex); - - // - double cPVRes = cMarket.pv.GetResistance(cIndex); - double pPVRes = cMarket.pv.GetResistance(pIndex); - - // - double cPVFib1 = cMarket.pv.GetFib1(cIndex); - double cPVFib2 = cMarket.pv.GetFib2(cIndex); - double cPVFib3 = cMarket.pv.GetFib3(cIndex); - double cPVFib4 = cMarket.pv.GetFib4(cIndex); - double cPVFib5 = cMarket.pv.GetFib5(cIndex); - - // - double pPVFib1 = cMarket.pv.GetFib1(pIndex); - double pPVFib2 = cMarket.pv.GetFib2(pIndex); - double pPVFib3 = cMarket.pv.GetFib3(pIndex); - double pPVFib4 = cMarket.pv.GetFib4(pIndex); - double pPVFib5 = cMarket.pv.GetFib5(pIndex); - - // - bool isNewPeak = cPVPeak != pPVPeak; - bool isNewPeakUnderLast = - // - isNewPeak && - cPVPeak < pPVPeak - // - ; - bool isNewPeakOverLast = - // - isNewPeak && - cPVPeak > pPVPeak - // - ; - - // - bool isNewVale = cPVVale != pPVVale; - bool isNewValeUnderLast = - // - isNewVale && - cPVVale < pPVVale - // - ; - bool isNewValeOverLast = - // - isNewVale && - cPVVale > pPVVale - // - ; - - // - bool isFiboIncreased = - // - cPVFib1 > pPVFib1 && - cPVFib2 > pPVFib2 && - cPVFib3 > pPVFib3 && - cPVFib4 > pPVFib4 && - cPVFib5 > pPVFib5 - // - ; - - // - bool isFiboDecreased = - // - cPVFib1 < pPVFib1 && - cPVFib2 < pPVFib2 && - cPVFib3 < pPVFib3 && - cPVFib4 < pPVFib4 && - cPVFib5 < pPVFib5 - // - ; - - // - bool isFiboSectionChanged = - // - (isFiboDecreased && - isNewPeakUnderLast) - // - || - // - (isFiboIncreased && - isNewValeOverLast) - // - ; - - // - // XFI ... - - // - double cFI = fiHelper.GetMain(cIndex); - double pFI = fiHelper.GetMain(pIndex); - - // - bool isCFIOverZero = cFI > 0; - bool isCFIUnderZero = cFI > 0; - - // - bool isPFIOverZero = pFI > 0; - bool isPFIUnderZero = pFI > 0; - - // - bool isFICrossedOverZero = - // - isCFIOverZero && - !isPFIOverZero - // - ; - - // - bool isFICrossedUnderZero = - // - isCFIUnderZero && - !isPFIUnderZero - // - ; - - // - // XHK ... - - // - XOHCL cSMHKBar; - cMarket.hk.SMAsOHCL( - cSMHKBar, - cIndex // - ); - - // - XOHCL pSMHKBar; - cMarket.hk.SMAsOHCL( - pSMHKBar, - pIndex // - ); - - // - bool isCSMHKBullish = cSMHKBar.IsBullish(); - bool isCSMHKBearish = cSMHKBar.IsBearish(); - - // - bool isPSMHKBullish = pSMHKBar.IsBullish(); - bool isPSMHKBearish = pSMHKBar.IsBearish(); - - // - bool isSMHKSwitchedToBullish = - // - isCSMHKBullish && - isPSMHKBearish - // - ; - - // - bool isSMHKSwitchedToBearish = - // - isCSMHKBearish && - isPSMHKBullish - // - ; - - // - // XTD ... - - // - double cTDBullish = tdHelper.GetBullish(cIndex); - double pTDBullish = tdHelper.GetBullish(pIndex); - - // - double cTDBearish = tdHelper.GetBearish(cIndex); - double pTDBearish = tdHelper.GetBearish(pIndex); - - // - bool isCTDBullish = - // - cTDBullish > cTDBearish - // - ; - - // - bool isCTDBearish = - // - cTDBearish > cTDBullish - // - ; - - // - bool isPTDBullish = - // - pTDBullish > pTDBearish - // - ; - - // - bool isPTDBearish = - // - pTDBearish > pTDBullish - // - ; - - // - bool isTDBullish = isCTDBullish; - bool isTDBearish = isCTDBearish; - bool isTDSwitchedToBullish = - // - isCTDBullish && - !isPTDBullish - // - ; - bool isTDSwitchedToBearsih = - // - isCTDBearish && - !isPTDBearish - // - ; - - // - // XDON ... - - // - XOHCL cBar = cMarket.GetBar(cIndex); - XOHCL pBar = cMarket.GetBar(pIndex); - - // - double cDONUpperOpen = cMarket.don.GetUpperO(cIndex); - double cDONUpperClose = cMarket.don.GetUpperC(cIndex); - double cDONUpperHigh = cMarket.don.GetUpperH(cIndex); - double cDONUpperLow = cMarket.don.GetUpperL(cIndex); - - // - double cDONLowerOpen = cMarket.don.GetLowerO(cIndex); - double cDONLowerClose = cMarket.don.GetLowerC(cIndex); - double cDONLowerHigh = cMarket.don.GetLowerH(cIndex); - double cDONLowerLow = cMarket.don.GetLowerL(cIndex); - - // - double pDONUpperOpen = cMarket.don.GetUpperO(pIndex); - double pDONUpperClose = cMarket.don.GetUpperC(pIndex); - double pDONUpperHigh = cMarket.don.GetUpperH(pIndex); - double pDONUpperLow = cMarket.don.GetUpperL(pIndex); - - // - double pDONLowerOpen = cMarket.don.GetLowerO(pIndex); - double pDONLowerClose = cMarket.don.GetLowerC(pIndex); - double pDONLowerHigh = cMarket.don.GetLowerH(pIndex); - double pDONLowerLow = cMarket.don.GetLowerL(pIndex); - - // - bool isBarCrossedDownDONLowerHigh = - // - cBar.IsBreakDown(pDONLowerHigh) - // - ; - - // - result = - // - isTrendSwitchedToBullish - // - ; - if (result) { - Print("Salam"); - } - // return result; } @@ -8003,86 +7594,85 @@ private: bool result = false; // - bool isCMStrLong = - // - mConditions.cMarketConditions.isTrendSwitchedToBullish && - (mConditions.hMarketConditions.isTrendBullish && - mConditions.lMarketConditions.isTrendBullish && - mConditions.mMarketConditions.isTrendBullish && - mConditions.sMarketConditions.isTrendBullish) - // - ; + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; // - bool isSMStrLong = - // - mConditions.sMarketConditions.isTrendSwitchedToBullish && - (mConditions.hMarketConditions.isTrendBullish && - mConditions.lMarketConditions.isTrendBullish && - mConditions.mMarketConditions.isTrendBullish && - mConditions.cMarketConditions.isTrendBullish) - // - ; + // Current Market ... + double cLowerHigh = cMarket.don.GetLowerH(cIndex); + bool cHasX786 = cMarket.HasX786LongConditions(); + if (cHasX786) + { + sl = cLowerHigh; + } // - bool isMMStrLong = - // - mConditions.mMarketConditions.isTrendSwitchedToBullish && - (mConditions.hMarketConditions.isTrendBullish && - mConditions.lMarketConditions.isTrendBullish && - mConditions.sMarketConditions.isTrendBullish && - mConditions.cMarketConditions.isTrendBullish) - // - ; + // Short Market ... + double sLowerHigh = sMarket.don.GetLowerH(cIndex); + bool sHasX786 = sMarket.HasX786LongConditions(); + if (sHasX786) + { + sl = sLowerHigh; + } // - bool isLMStrLong = - // - mConditions.lMarketConditions.isTrendSwitchedToBullish && - (mConditions.hMarketConditions.isTrendBullish && - mConditions.mMarketConditions.isTrendBullish && - mConditions.sMarketConditions.isTrendBullish && - mConditions.cMarketConditions.isTrendBullish) - // - ; + // Medium Market ... + double mLowerHigh = mMarket.don.GetLowerH(cIndex); + bool mHasX786 = mMarket.HasX786LongConditions(); + if (mHasX786) + { + sl = mLowerHigh; + } // - bool isHMStrLong = - // - mConditions.hMarketConditions.isTrendSwitchedToBullish && - (mConditions.lMarketConditions.isTrendBullish && - mConditions.mMarketConditions.isTrendBullish && - mConditions.sMarketConditions.isTrendBullish && - mConditions.cMarketConditions.isTrendBullish) - // - ; + // Long Market ... + double lLowerHigh = lMarket.don.GetLowerH(cIndex); + bool lHasX786 = lMarket.HasX786LongConditions(); + if (lHasX786) + { + sl = lLowerHigh; + } // - // bool isScorePassed = IsScorePassedForLong(); + // Hind Market ... + double hLowerHigh = hMarket.don.GetLowerH(cIndex); + bool hHasX786 = hMarket.HasX786LongConditions(); + if (hHasX786) + { + sl = hLowerHigh; + } // result = // - // isCMStrLong - // // - // || - // // - // isSMStrLong - // // - // || - // - isMMStrLong + cHasX786 // || // - isLMStrLong + sHasX786 // || // - isHMStrLong + mHasX786 + // + || + // + lHasX786 + // + // || + // // + // hHasX786 // ; + // + if (result) + { + // + r2r = 2; + } + // return result; } @@ -9155,83 +8745,85 @@ private: bool result = false; // - bool isCMStrShort = - // - mConditions.cMarketConditions.isTrendSwitchedToBearish && - (mConditions.hMarketConditions.isTrendBearish && - mConditions.lMarketConditions.isTrendBearish && - mConditions.mMarketConditions.isTrendBearish && - mConditions.sMarketConditions.isTrendBearish) - // - ; + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; // - bool isSMStrShort = - // - mConditions.sMarketConditions.isTrendSwitchedToBearish && - (mConditions.hMarketConditions.isTrendBearish && - mConditions.lMarketConditions.isTrendBearish && - mConditions.mMarketConditions.isTrendBearish && - mConditions.cMarketConditions.isTrendBearish) - // - ; + // Current Market ... + double cUpperLow = cMarket.don.GetUpperL(cIndex); + bool cHasX786 = cMarket.HasX786ShortConditions(); + if (cHasX786) + { + sl = cUpperLow; + } // - bool isMMStrShort = - // - mConditions.mMarketConditions.isTrendSwitchedToBearish && - (mConditions.hMarketConditions.isTrendBearish && - mConditions.lMarketConditions.isTrendBearish && - mConditions.sMarketConditions.isTrendBearish && - mConditions.cMarketConditions.isTrendBearish) - // - ; + // Short Market ... + double sUpperLow = sMarket.don.GetUpperL(cIndex); + bool sHasX786 = sMarket.HasX786ShortConditions(); + if (sHasX786) + { + sl = sUpperLow; + } // - bool isLMStrShort = - // - mConditions.lMarketConditions.isTrendSwitchedToBearish && - (mConditions.hMarketConditions.isTrendBearish && - mConditions.mMarketConditions.isTrendBearish && - mConditions.sMarketConditions.isTrendBearish && - mConditions.cMarketConditions.isTrendBearish) - // - ; + // Medium Market ... + double mUpperLow = mMarket.don.GetUpperL(cIndex); + bool mHasX786 = mMarket.HasX786ShortConditions(); + if (mHasX786) + { + sl = mUpperLow; + } // - bool isHMStrShort = - // - mConditions.hMarketConditions.isTrendSwitchedToBearish && - (mConditions.lMarketConditions.isTrendBearish && - mConditions.mMarketConditions.isTrendBearish && - mConditions.sMarketConditions.isTrendBearish && - mConditions.cMarketConditions.isTrendBearish) - // - ; + // Long Market ... + double lUpperLow = lMarket.don.GetUpperL(cIndex); + bool lHasX786 = lMarket.HasX786ShortConditions(); + if (lHasX786) + { + sl = lUpperLow; + } + + // + // Hind Market ... + double hUpperLow = hMarket.don.GetUpperL(cIndex); + bool hHasX786 = hMarket.HasX786ShortConditions(); + if (hHasX786) + { + sl = hUpperLow; + } // result = // - // isCMStrShort - // // - // || - // // - // isSMStrShort - // // - // || - // - isMMStrShort + cHasX786 // || // - isLMStrShort + sHasX786 // || // - isHMStrShort + mHasX786 + // + || + // + lHasX786 + // + // || + // // + // hHasX786 // ; + // + if (result) + { + // + r2r = 2; + } + // return result; } diff --git a/Classes/x-saherelm.x121.xea.class.mq5 b/Classes/x-saherelm.x121.xea.class.mq5 index 95851db2..29005b63 100644 --- a/Classes/x-saherelm.x121.xea.class.mq5 +++ b/Classes/x-saherelm.x121.xea.class.mq5 @@ -730,16 +730,16 @@ public: } // - void HandleTrailManagement(XPosition &positions[]) + void HandleTrailManagement(XPosition &positions[]) { // // TODO: // Make them Configurable ... int maxTrailTPs = 5; // int levelsOnClose = 6; - int riskFreeLevel = 4; + int riskFreeLevel = 0; int requiredAgeForTrail = 0; - int requiredDistanceForTrail = 10; + int requiredDistanceForTrail = 50; // int positionsCount = ArraySize(positions); @@ -811,13 +811,19 @@ public: // double slDiff = PointToPrice(priceDistance, iPosition.symbol); - double appliedSL = slDiff; + double appliedSL = slDiff / 2; + // + // double sl = + // IsLong(iPosition.type) + // ? iPosition.sl + appliedSL + // : iPosition.sl - appliedSL; + // double sl = IsLong(iPosition.type) - ? iPosition.sl + appliedSL - : iPosition.sl - appliedSL; + ? iPosition.entry + appliedSL + : iPosition.entry - appliedSL; // // double sl = diff --git a/Classes/x-saherelm.x121.xmcycle.class.mq5 b/Classes/x-saherelm.x121.xmcycle.class.mq5 index 6065c14d..8f736bff 100644 --- a/Classes/x-saherelm.x121.xmcycle.class.mq5 +++ b/Classes/x-saherelm.x121.xmcycle.class.mq5 @@ -27,6 +27,7 @@ #include "../Libraries/x-saherelm.draw.lib.mq5" // +#include "../Helpers/x-saherelm.xtd.helper.mq5" #include "../Helpers/x-saherelm.xhk.helper.mq5" #include "../Helpers/x-saherelm.xmc.helper.mq5" #include "../Helpers/x-saherelm.xpv.helper.mq5" @@ -80,6 +81,7 @@ public: 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 ... @@ -163,6 +165,7 @@ public: XMCInputs &mMcInputs, // MC Inputs XPVInputs &mPvInputs, // PV Inputs ... XZGInputs &mZgInputs, // ZG Inputs ... + XTDInputs &mTdInputs, // TD Inputs ... XMRBInputs &mMrbInputs, // MRB Inputs ... XSTRInputs &mStrInputs, // STR Inputs XOSCInputs &mOscInputs, // OSC Inputs @@ -195,6 +198,7 @@ public: mcInputs = mMcInputs; pvInputs = mPvInputs; zgInputs = mZgInputs; + tdInputs = mTdInputs; mrbInputs = mMrbInputs; strInputs = mStrInputs; oscInputs = mOscInputs; @@ -225,6 +229,7 @@ public: mcInputs.Clean(); pvInputs.Clean(); zgInputs.Clean(); + tdInputs.Clean(); mrbInputs.Clean(); strInputs.Clean(); oscInputs.Clean(); @@ -255,6 +260,7 @@ public: mcInputs.Default(); pvInputs.Default(); zgInputs.Default(); + tdInputs.Default(); mrbInputs.Default(); strInputs.Default(); oscInputs.Default(); @@ -312,6 +318,13 @@ public: return result; } + // + result = tdInputs.IsValid(); + if (!result) + { + return result; + } + // result = mrbInputs.IsValid(); if (!result) @@ -373,6 +386,7 @@ public: result = MathMax(result, mcInputs.Max()); result = MathMax(result, pvInputs.Max()); result = MathMax(result, zgInputs.Max()); + result = MathMax(result, tdInputs.Max()); result = MathMax(result, mrbInputs.Max()); result = MathMax(result, strInputs.Max()); result = MathMax(result, oscInputs.Max()); @@ -522,6 +536,29 @@ public: double oscStochSignals[]; double oscStddevs[]; + // + // XTD ... + double tdBullishs[]; + double tdBearishs[]; + double tdSignals[]; + + // + // XTD ... + bool isXTDSignalPeak; + bool isXTDSignalVale; + bool isXTDBullishPeak; + bool isXTDBullishVale; + bool isXTDBearishPeak; + bool isXTDBearishVale; + bool isXTDBullOverBear; + bool isXTDBullUnderBear; + bool isXTDSignalOverBear; + bool isXTDSignalUnderBear; + bool isXTDBullCrossedOverBear; + bool isXTDBullCrossedUnderBear; + bool isXTDSignalCrossedOverBear; + bool isXTDSignalCrossedUnderBear; + // // XHK ... @@ -1165,6 +1202,26 @@ public: Clean(pvLCLLs); Clean(pvHCHHs); Clean(pvHCLLs); + Clean(tdBullishs); + Clean(tdBearishs); + Clean(tdSignals); + + // + // XTD ... + isXTDSignalPeak = false; + isXTDSignalVale = false; + isXTDBullishPeak = false; + isXTDBullishVale = false; + isXTDBearishPeak = false; + isXTDBearishVale = false; + isXTDBullOverBear = false; + isXTDBullUnderBear = false; + isXTDSignalOverBear = false; + isXTDSignalUnderBear = false; + isXTDBullCrossedOverBear = false; + isXTDBullCrossedUnderBear = false; + isXTDSignalCrossedOverBear = false; + isXTDSignalCrossedUnderBear = false; // // Buffers ... @@ -1491,6 +1548,113 @@ public: bearScore++; } + // + // XTD ... + + // + if (isXTDSignalPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDSignalVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBullishPeak) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDBullishVale) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBearishPeak) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBearishVale) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDBullOverBear) + { + bullScore++; + } + + // + if (isXTDBullUnderBear) + { + bearScore++; + } + + // + if (isXTDSignalOverBear) + { + bullScore++; + } + + // + if (isXTDSignalUnderBear) + { + bearScore++; + } + + // + if (isXTDBullCrossedOverBear) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDBullCrossedUnderBear) + { + // + bullScore--; + bearScore++; + } + + // + if (isXTDSignalCrossedOverBear) + { + // + bullScore++; + bearScore--; + } + + // + if (isXTDSignalCrossedUnderBear) + { + // + bullScore--; + bearScore++; + } + // // XHK ... @@ -2446,6 +2610,29 @@ public: ; zigzagStr = SetLabel("XZG: ", zigzagStr, separator); + // + // XTD ... + string tdStr = + // + ToString("isXTDSignalPeak", isXTDSignalPeak, ignoreFalseConditions) + + ToString("isXTDSignalVale", isXTDSignalVale, ignoreFalseConditions) + + ToString("isXTDBullishPeak", isXTDBullishPeak, ignoreFalseConditions) + + ToString("isXTDBullishVale", isXTDBullishVale, ignoreFalseConditions) + + ToString("isXTDBearishPeak", isXTDBearishPeak, ignoreFalseConditions) + + ToString("isXTDBearishVale", isXTDBearishVale, ignoreFalseConditions) + + ToString("isXTDBullOverBear", isXTDBullOverBear, ignoreFalseConditions) + + ToString("isXTDBullUnderBear", isXTDBullUnderBear, ignoreFalseConditions) + + ToString("isXTDSignalOverBear", isXTDSignalOverBear, ignoreFalseConditions) + + ToString("isXTDSignalUnderBear", isXTDSignalUnderBear, ignoreFalseConditions) + + ToString("isXTDBullCrossedOverBear", isXTDBullCrossedOverBear, ignoreFalseConditions) + + ToString("isXTDBullCrossedUnderBear", isXTDBullCrossedUnderBear, ignoreFalseConditions) + + ToString("isXTDSignalCrossedOverBear", isXTDSignalCrossedOverBear, ignoreFalseConditions) + + ToString("isXTDSignalCrossedUnderBear", isXTDSignalCrossedUnderBear, ignoreFalseConditions) + + "" + // + ; + tdStr = SetLabel("XTD: ", tdStr, separator); + // // XMR ... string mrbStr = @@ -2739,6 +2926,7 @@ public: (onlySummary ? "" : hkStr + + tdStr + zigzagStr + mrbStr + strStr + @@ -2812,6 +3000,7 @@ public: XSCXMCHelper mc; XSCXPVHelper pv; XSCXZGHelper zg; + XSCXTDHelper td; XSCXMRBHelper mrb; XSCXSTRHelper str; XSCXCHEHelper che; @@ -4714,6 +4903,817 @@ public: conditions.isSTDDEVUnderLast = isSTDDEVUnderLast; } + // + // Market Parse Conditions ... + + // + // X786 Long ... + bool HasX786LongConditions() + { + // + bool result = false; + + // + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + + // + XOHCL cBar = GetBar(cIndex); + XOHCL pBar = GetBar(pIndex); + + // + // XPV ... + + double cPVPeak = pv.GetPeak(cIndex); + double cPVVale = pv.GetVale(cIndex); + + // + double pPVPeak = pv.GetPeak(pIndex); + double pPVVale = pv.GetVale(pIndex); + + // + double cPVSup = pv.GetSupport(cIndex); + double pPVSup = pv.GetSupport(pIndex); + + // + double cPVRes = pv.GetResistance(cIndex); + double pPVRes = pv.GetResistance(pIndex); + + // + double cPVFib1 = pv.GetFib1(cIndex); + double cPVFib2 = pv.GetFib2(cIndex); + double cPVFib3 = pv.GetFib3(cIndex); + double cPVFib4 = pv.GetFib4(cIndex); + double cPVFib5 = pv.GetFib5(cIndex); + + // + double pPVFib1 = pv.GetFib1(pIndex); + double pPVFib2 = pv.GetFib2(pIndex); + double pPVFib3 = pv.GetFib3(pIndex); + double pPVFib4 = pv.GetFib4(pIndex); + double pPVFib5 = pv.GetFib5(pIndex); + + // + bool isNewPeak = cPVPeak != pPVPeak; + bool isNewPeakUnderLast = + // + isNewPeak && + cPVPeak < pPVPeak + // + ; + bool isNewPeakOverLast = + // + isNewPeak && + cPVPeak > pPVPeak + // + ; + + // + bool isNewVale = cPVVale != pPVVale; + bool isNewValeUnderLast = + // + isNewVale && + cPVVale < pPVVale + // + ; + bool isNewValeOverLast = + // + isNewVale && + cPVVale > pPVVale + // + ; + + // + bool isFiboIncreased = + // + cPVFib1 > pPVFib1 && + cPVFib2 > pPVFib2 && + cPVFib3 > pPVFib3 && + cPVFib4 > pPVFib4 && + cPVFib5 > pPVFib5 + // + ; + + // + bool isFiboDecreased = + // + cPVFib1 < pPVFib1 && + cPVFib2 < pPVFib2 && + cPVFib3 < pPVFib3 && + cPVFib4 < pPVFib4 && + cPVFib5 < pPVFib5 + // + ; + + // + bool isFiboSectionChanged = + // + (isFiboDecreased && + isNewPeakUnderLast) + // + || + // + (isFiboIncreased && + isNewValeOverLast) + // + ; + + // + // XHK ... + + // + XOHCL cSMHKBar; + hk.SMAsOHCL( + cSMHKBar, + cIndex // + ); + + // + XOHCL pSMHKBar; + hk.SMAsOHCL( + pSMHKBar, + pIndex // + ); + + // + bool isCSMHKBullish = cSMHKBar.IsBullish(); + bool isCSMHKBearish = cSMHKBar.IsBearish(); + + // + bool isPSMHKBullish = pSMHKBar.IsBullish(); + bool isPSMHKBearish = pSMHKBar.IsBearish(); + + // + bool isSMHKBullish = isCSMHKBullish; + bool isSMHKBearish = isCSMHKBearish; + bool isSMHKSwitchedToBullish = + // + isCSMHKBullish && + isPSMHKBearish + // + ; + + // + bool isSMHKSwitchedToBearish = + // + isCSMHKBearish && + isPSMHKBullish + // + ; + + // + // XSTR ... + + // + ENUM_XSTR_TREND_STATES cStrState = str + .GetState(cIndex); + double cStrTrend = str.GetTrend(cIndex); + bool isCStrBullish = cStrState == X_STR_BULLISH; + bool isCStrBearish = cStrState == X_STR_BEARISH; + + // + ENUM_XSTR_TREND_STATES pStrState = str + .GetState(pIndex); + double pStrTrend = str.GetTrend(pIndex); + bool isPStrBullish = pStrState == X_STR_BULLISH; + bool isPStrBearish = pStrState == X_STR_BEARISH; + + // + bool isTrendBullish = isCStrBullish; + bool isTrendBearish = isCStrBearish; + + // + bool isTrendSwitchedToBullish = + // + isCStrBullish && + !isPStrBullish + // + ; + + // + bool isTrendSwitchedToBearish = + // + isCStrBearish && + !isPStrBearish + // + ; + + // + // XTD ... + + // + double cTDBullish = td.GetBullish(cIndex); + double pTDBullish = td.GetBullish(pIndex); + + // + double cTDBearish = td.GetBearish(cIndex); + double pTDBearish = td.GetBearish(pIndex); + + // + bool isCTDBullish = + // + cTDBullish > cTDBearish + // + ; + + // + bool isCTDBearish = + // + cTDBearish > cTDBullish + // + ; + + // + bool isPTDBullish = + // + pTDBullish > pTDBearish + // + ; + + // + bool isPTDBearish = + // + pTDBearish > pTDBullish + // + ; + + // + bool isTDBullish = isCTDBullish; + bool isTDBearish = isCTDBearish; + bool isTDSwitchedToBullish = + // + isCTDBullish && + !isPTDBullish + // + ; + bool isTDSwitchedToBearish = + // + isCTDBearish && + !isPTDBearish + // + ; + + // + // XCHE ... + + // + double cCHELongExit1 = che.GetLongExit1(cIndex); + double cCHELongExit2 = che.GetLongExit2(cIndex); + + // + double pCHELongExit1 = che.GetLongExit1(pIndex); + double pCHELongExit2 = che.GetLongExit2(pIndex); + + // + double cCHEShortExit1 = che.GetShortExit1(cIndex); + double cCHEShortExit2 = che.GetShortExit2(cIndex); + + // + double pCHEShortExit1 = che.GetShortExit1(pIndex); + double pCHEShortExit2 = che.GetShortExit2(pIndex); + + // + bool CCHEHasLongExit1 = NotEmpty(cCHELongExit1); + bool CCHEHasLongExit2 = NotEmpty(cCHELongExit2); + + // + bool CCHEHasShortExit1 = NotEmpty(cCHEShortExit1); + bool CCHEHasShortExit2 = NotEmpty(cCHEShortExit2); + + // + bool PCHEHasLongExit1 = NotEmpty(pCHELongExit1); + bool PCHEHasLongExit2 = NotEmpty(pCHELongExit2); + + // + bool PCHEHasShortExit1 = NotEmpty(pCHEShortExit1); + bool PCHEHasShortExit2 = NotEmpty(pCHEShortExit2); + + // + bool isCCHEBullish = + // + CCHEHasLongExit1 && + CCHEHasLongExit2 + // + ; + + // + bool isCCHEBearish = + // + CCHEHasShortExit1 && + CCHEHasShortExit2 + // + ; + + // + bool isPCHEBullish = + // + PCHEHasLongExit1 && + PCHEHasLongExit2 + // + ; + + // + bool isPCHEBearish = + // + PCHEHasShortExit1 && + PCHEHasShortExit2 + // + ; + + // + bool isCHEBullish = isCCHEBullish; + bool isCHEBearish = isCCHEBearish; + bool isCHESwitchedToBullish = + // + isCCHEBullish && + !isPCHEBullish + // + ; + bool isCHESwitchedToBearish = + // + isCCHEBearish && + !isPCHEBearish + // + ; + + // + double cDONUpperOpen = don.GetUpperO(cIndex); + double cDONUpperClose = don.GetUpperC(cIndex); + double cDONUpperHigh = don.GetUpperH(cIndex); + double cDONUpperLow = don.GetUpperL(cIndex); + + // + double cDONLowerOpen = don.GetLowerO(cIndex); + double cDONLowerClose = don.GetLowerC(cIndex); + double cDONLowerHigh = don.GetLowerH(cIndex); + double cDONLowerLow = don.GetLowerL(cIndex); + + // + double pDONUpperOpen = don.GetUpperO(pIndex); + double pDONUpperClose = don.GetUpperC(pIndex); + double pDONUpperHigh = don.GetUpperH(pIndex); + double pDONUpperLow = don.GetUpperL(pIndex); + + // + double pDONLowerOpen = don.GetLowerO(pIndex); + double pDONLowerClose = don.GetLowerC(pIndex); + double pDONLowerHigh = don.GetLowerH(pIndex); + double pDONLowerLow = don.GetLowerL(pIndex); + + // + bool isBarCrossedDownDONLowerHigh = + // + cBar.IsBreakDown(pDONLowerHigh) + // + ; + + // + bool isBarCrossedUpDONLowerHigh = + // + cBar.IsBreakUp(pDONLowerHigh) + // + ; + + // + result = + // + (isSMHKSwitchedToBullish && + (isTDBullish && + isCHEBullish && + isTrendBullish)) + // + || + // + (isTDSwitchedToBullish && + (isSMHKBullish && + isCHEBullish && + isTrendBullish)) + // + || + // + (isCHESwitchedToBullish && + (isTDBullish && + isSMHKBullish && + isTrendBullish)) + // + || + // + (isTrendSwitchedToBullish && + (isTDBullish && + isCHEBullish && + isSMHKBullish)) + // + ; + + // + return result; + } + + // + // X786 Short ... + bool HasX786ShortConditions() + { + // + bool result = false; + + // + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + + // + XOHCL cBar = GetBar(cIndex); + XOHCL pBar = GetBar(pIndex); + + // + // XPV ... + + double cPVPeak = pv.GetPeak(cIndex); + double cPVVale = pv.GetVale(cIndex); + + // + double pPVPeak = pv.GetPeak(pIndex); + double pPVVale = pv.GetVale(pIndex); + + // + double cPVSup = pv.GetSupport(cIndex); + double pPVSup = pv.GetSupport(pIndex); + + // + double cPVRes = pv.GetResistance(cIndex); + double pPVRes = pv.GetResistance(pIndex); + + // + double cPVFib1 = pv.GetFib1(cIndex); + double cPVFib2 = pv.GetFib2(cIndex); + double cPVFib3 = pv.GetFib3(cIndex); + double cPVFib4 = pv.GetFib4(cIndex); + double cPVFib5 = pv.GetFib5(cIndex); + + // + double pPVFib1 = pv.GetFib1(pIndex); + double pPVFib2 = pv.GetFib2(pIndex); + double pPVFib3 = pv.GetFib3(pIndex); + double pPVFib4 = pv.GetFib4(pIndex); + double pPVFib5 = pv.GetFib5(pIndex); + + // + bool isNewPeak = cPVPeak != pPVPeak; + bool isNewPeakUnderLast = + // + isNewPeak && + cPVPeak < pPVPeak + // + ; + bool isNewPeakOverLast = + // + isNewPeak && + cPVPeak > pPVPeak + // + ; + + // + bool isNewVale = cPVVale != pPVVale; + bool isNewValeUnderLast = + // + isNewVale && + cPVVale < pPVVale + // + ; + bool isNewValeOverLast = + // + isNewVale && + cPVVale > pPVVale + // + ; + + // + bool isFiboIncreased = + // + cPVFib1 > pPVFib1 && + cPVFib2 > pPVFib2 && + cPVFib3 > pPVFib3 && + cPVFib4 > pPVFib4 && + cPVFib5 > pPVFib5 + // + ; + + // + bool isFiboDecreased = + // + cPVFib1 < pPVFib1 && + cPVFib2 < pPVFib2 && + cPVFib3 < pPVFib3 && + cPVFib4 < pPVFib4 && + cPVFib5 < pPVFib5 + // + ; + + // + bool isFiboSectionChanged = + // + (isFiboDecreased && + isNewPeakUnderLast) + // + || + // + (isFiboIncreased && + isNewValeOverLast) + // + ; + + // + // XHK ... + + // + XOHCL cSMHKBar; + hk.SMAsOHCL( + cSMHKBar, + cIndex // + ); + + // + XOHCL pSMHKBar; + hk.SMAsOHCL( + pSMHKBar, + pIndex // + ); + + // + bool isCSMHKBullish = cSMHKBar.IsBullish(); + bool isCSMHKBearish = cSMHKBar.IsBearish(); + + // + bool isPSMHKBullish = pSMHKBar.IsBullish(); + bool isPSMHKBearish = pSMHKBar.IsBearish(); + + // + bool isSMHKBullish = isCSMHKBullish; + bool isSMHKBearish = isCSMHKBearish; + bool isSMHKSwitchedToBullish = + // + isCSMHKBullish && + isPSMHKBearish + // + ; + + // + bool isSMHKSwitchedToBearish = + // + isCSMHKBearish && + isPSMHKBullish + // + ; + + // + // XSTR ... + + // + ENUM_XSTR_TREND_STATES cStrState = str + .GetState(cIndex); + double cStrTrend = str.GetTrend(cIndex); + bool isCStrBullish = cStrState == X_STR_BULLISH; + bool isCStrBearish = cStrState == X_STR_BEARISH; + + // + ENUM_XSTR_TREND_STATES pStrState = str + .GetState(pIndex); + double pStrTrend = str.GetTrend(pIndex); + bool isPStrBullish = pStrState == X_STR_BULLISH; + bool isPStrBearish = pStrState == X_STR_BEARISH; + + // + bool isTrendBullish = isCStrBullish; + bool isTrendBearish = isCStrBearish; + + // + bool isTrendSwitchedToBullish = + // + isCStrBullish && + !isPStrBullish + // + ; + + // + bool isTrendSwitchedToBearish = + // + isCStrBearish && + !isPStrBearish + // + ; + + // + // XTD ... + + // + double cTDBullish = td.GetBullish(cIndex); + double pTDBullish = td.GetBullish(pIndex); + + // + double cTDBearish = td.GetBearish(cIndex); + double pTDBearish = td.GetBearish(pIndex); + + // + bool isCTDBullish = + // + cTDBullish > cTDBearish + // + ; + + // + bool isCTDBearish = + // + cTDBearish > cTDBullish + // + ; + + // + bool isPTDBullish = + // + pTDBullish > pTDBearish + // + ; + + // + bool isPTDBearish = + // + pTDBearish > pTDBullish + // + ; + + // + bool isTDBullish = isCTDBullish; + bool isTDBearish = isCTDBearish; + bool isTDSwitchedToBullish = + // + isCTDBullish && + !isPTDBullish + // + ; + bool isTDSwitchedToBearish = + // + isCTDBearish && + !isPTDBearish + // + ; + + // + // XCHE ... + + // + double cCHELongExit1 = che.GetLongExit1(cIndex); + double cCHELongExit2 = che.GetLongExit2(cIndex); + + // + double pCHELongExit1 = che.GetLongExit1(pIndex); + double pCHELongExit2 = che.GetLongExit2(pIndex); + + // + double cCHEShortExit1 = che.GetShortExit1(cIndex); + double cCHEShortExit2 = che.GetShortExit2(cIndex); + + // + double pCHEShortExit1 = che.GetShortExit1(pIndex); + double pCHEShortExit2 = che.GetShortExit2(pIndex); + + // + bool CCHEHasLongExit1 = NotEmpty(cCHELongExit1); + bool CCHEHasLongExit2 = NotEmpty(cCHELongExit2); + + // + bool CCHEHasShortExit1 = NotEmpty(cCHEShortExit1); + bool CCHEHasShortExit2 = NotEmpty(cCHEShortExit2); + + // + bool PCHEHasLongExit1 = NotEmpty(pCHELongExit1); + bool PCHEHasLongExit2 = NotEmpty(pCHELongExit2); + + // + bool PCHEHasShortExit1 = NotEmpty(pCHEShortExit1); + bool PCHEHasShortExit2 = NotEmpty(pCHEShortExit2); + + // + bool isCCHEBullish = + // + CCHEHasLongExit1 && + CCHEHasLongExit2 + // + ; + + // + bool isCCHEBearish = + // + CCHEHasShortExit1 && + CCHEHasShortExit2 + // + ; + + // + bool isPCHEBullish = + // + PCHEHasLongExit1 && + PCHEHasLongExit2 + // + ; + + // + bool isPCHEBearish = + // + PCHEHasShortExit1 && + PCHEHasShortExit2 + // + ; + + // + bool isCHEBullish = isCCHEBullish; + bool isCHEBearish = isCCHEBearish; + bool isCHESwitchedToBullish = + // + isCCHEBullish && + !isPCHEBullish + // + ; + bool isCHESwitchedToBearish = + // + isCCHEBearish && + !isPCHEBearish + // + ; + + // + double cDONUpperOpen = don.GetUpperO(cIndex); + double cDONUpperClose = don.GetUpperC(cIndex); + double cDONUpperHigh = don.GetUpperH(cIndex); + double cDONUpperLow = don.GetUpperL(cIndex); + + // + double cDONLowerOpen = don.GetLowerO(cIndex); + double cDONLowerClose = don.GetLowerC(cIndex); + double cDONLowerHigh = don.GetLowerH(cIndex); + double cDONLowerLow = don.GetLowerL(cIndex); + + // + double pDONUpperOpen = don.GetUpperO(pIndex); + double pDONUpperClose = don.GetUpperC(pIndex); + double pDONUpperHigh = don.GetUpperH(pIndex); + double pDONUpperLow = don.GetUpperL(pIndex); + + // + double pDONLowerOpen = don.GetLowerO(pIndex); + double pDONLowerClose = don.GetLowerC(pIndex); + double pDONLowerHigh = don.GetLowerH(pIndex); + double pDONLowerLow = don.GetLowerL(pIndex); + + // + bool isBarCrossedDownDONLowerHigh = + // + cBar.IsBreakDown(pDONLowerHigh) + // + ; + + // + bool isBarCrossedUpDONLowerHigh = + // + cBar.IsBreakUp(pDONLowerHigh) + // + ; + + // + result = + // + (isSMHKSwitchedToBearish && + (isTDBearish && + isCHEBearish && + isTrendBearish)) + // + || + // + (isTDSwitchedToBearish && + (isSMHKBearish && + isCHEBearish && + isTrendBearish)) + // + || + // + (isCHESwitchedToBearish && + (isTDBearish && + isSMHKBearish && + isTrendBearish)) + // + || + // + (isTrendSwitchedToBearish && + (isTDBearish && + isCHEBearish && + isSMHKBearish)) + // + ; + + // + return result; + } + // // Initial Market Cycle ... bool Init( @@ -4793,6 +5793,19 @@ public: return result; } + // + // XTD ... + result = td.Init( + symbol, + period, + mInputs.tdInputs + // + ); + if (!result) + { + return result; + } + // // XMRB ... result = mrb.Init( diff --git a/Documents/BKP/SingallingXTDNew.mq5 b/Documents/BKP/SingallingXTDNew.mq5 new file mode 100644 index 00000000..008cda69 --- /dev/null +++ b/Documents/BKP/SingallingXTDNew.mq5 @@ -0,0 +1,415 @@ + // + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + + // + // XSTR ... + ENUM_XSTR_TREND_STATES cStrState = cMarket + .str + .GetState(cIndex); + double cStrTrend = cMarket.str.GetTrend(cIndex); + bool isCStrBullish = cStrState == X_STR_BULLISH; + bool isCStrBearish = cStrState == X_STR_BEARISH; + + // + ENUM_XSTR_TREND_STATES pStrState = cMarket + .str + .GetState(pIndex); + double pStrTrend = cMarket.str.GetTrend(pIndex); + bool isPStrBullish = pStrState == X_STR_BULLISH; + bool isPStrBearish = pStrState == X_STR_BEARISH; + + // + bool isTrendBullish = isCStrBullish; + bool isTrendBearish = isCStrBearish; + + // + bool isTrendSwitchedToBullish = + // + isCStrBullish && + !isPStrBullish + // + ; + + // + bool isTrendSwitchedToBearish = + // + isCStrBearish && + !isPStrBearish + // + ; + + // + // XCHE ... + + // + double cCHELongExit1 = cMarket.che.GetLongExit1(cIndex); + double cCHELongExit2 = cMarket.che.GetLongExit2(cIndex); + + // + double pCHELongExit1 = cMarket.che.GetLongExit1(pIndex); + double pCHELongExit2 = cMarket.che.GetLongExit2(pIndex); + + // + double cCHEShortExit1 = cMarket.che.GetShortExit1(cIndex); + double cCHEShortExit2 = cMarket.che.GetShortExit2(cIndex); + + // + double pCHEShortExit1 = cMarket.che.GetShortExit1(pIndex); + double pCHEShortExit2 = cMarket.che.GetShortExit2(pIndex); + + // + bool CCHEHasLongExit1 = NotEmpty(cCHELongExit1); + bool CCHEHasLongExit2 = NotEmpty(cCHELongExit2); + + // + bool CCHEHasShortExit1 = NotEmpty(cCHEShortExit1); + bool CCHEHasShortExit2 = NotEmpty(cCHEShortExit2); + + // + bool PCHEHasLongExit1 = NotEmpty(pCHELongExit1); + bool PCHEHasLongExit2 = NotEmpty(pCHELongExit2); + + // + bool PCHEHasShortExit1 = NotEmpty(pCHEShortExit1); + bool PCHEHasShortExit2 = NotEmpty(pCHEShortExit2); + + // + bool isCCHEBullish = + // + CCHEHasLongExit1 && + CCHEHasLongExit2 + // + ; + + // + bool isCCHEBearish = + // + CCHEHasShortExit1 && + CCHEHasShortExit2 + // + ; + + // + bool isPCHEBullish = + // + PCHEHasLongExit1 && + PCHEHasLongExit2 + // + ; + + // + bool isPCHEBearish = + // + PCHEHasShortExit1 && + PCHEHasShortExit2 + // + ; + + // + bool isCHEBullish = isCCHEBullish; + bool isCHEBearish = isCCHEBearish; + bool isCHESwitchedToBullish = + // + isCCHEBullish && + !isPCHEBullish + // + ; + bool isCHESwitchedToBearish = + // + isCCHEBearish && + !isPCHEBearish + // + ; + + // + // XPV ... + + double cPVPeak = cMarket.pv.GetPeak(cIndex); + double cPVVale = cMarket.pv.GetVale(cIndex); + + // + double pPVPeak = cMarket.pv.GetPeak(pIndex); + double pPVVale = cMarket.pv.GetVale(pIndex); + + // + double cPVSup = cMarket.pv.GetSupport(cIndex); + double pPVSup = cMarket.pv.GetSupport(pIndex); + + // + double cPVRes = cMarket.pv.GetResistance(cIndex); + double pPVRes = cMarket.pv.GetResistance(pIndex); + + // + double cPVFib1 = cMarket.pv.GetFib1(cIndex); + double cPVFib2 = cMarket.pv.GetFib2(cIndex); + double cPVFib3 = cMarket.pv.GetFib3(cIndex); + double cPVFib4 = cMarket.pv.GetFib4(cIndex); + double cPVFib5 = cMarket.pv.GetFib5(cIndex); + + // + double pPVFib1 = cMarket.pv.GetFib1(pIndex); + double pPVFib2 = cMarket.pv.GetFib2(pIndex); + double pPVFib3 = cMarket.pv.GetFib3(pIndex); + double pPVFib4 = cMarket.pv.GetFib4(pIndex); + double pPVFib5 = cMarket.pv.GetFib5(pIndex); + + // + bool isNewPeak = cPVPeak != pPVPeak; + bool isNewPeakUnderLast = + // + isNewPeak && + cPVPeak < pPVPeak + // + ; + bool isNewPeakOverLast = + // + isNewPeak && + cPVPeak > pPVPeak + // + ; + + // + bool isNewVale = cPVVale != pPVVale; + bool isNewValeUnderLast = + // + isNewVale && + cPVVale < pPVVale + // + ; + bool isNewValeOverLast = + // + isNewVale && + cPVVale > pPVVale + // + ; + + // + bool isFiboIncreased = + // + cPVFib1 > pPVFib1 && + cPVFib2 > pPVFib2 && + cPVFib3 > pPVFib3 && + cPVFib4 > pPVFib4 && + cPVFib5 > pPVFib5 + // + ; + + // + bool isFiboDecreased = + // + cPVFib1 < pPVFib1 && + cPVFib2 < pPVFib2 && + cPVFib3 < pPVFib3 && + cPVFib4 < pPVFib4 && + cPVFib5 < pPVFib5 + // + ; + + // + bool isFiboSectionChanged = + // + (isFiboDecreased && + isNewPeakUnderLast) + // + || + // + (isFiboIncreased && + isNewValeOverLast) + // + ; + + // + // XFI ... + + // + double cFI = fiHelper.GetMain(cIndex); + double pFI = fiHelper.GetMain(pIndex); + + // + bool isCFIOverZero = cFI > 0; + bool isCFIUnderZero = cFI > 0; + + // + bool isPFIOverZero = pFI > 0; + bool isPFIUnderZero = pFI > 0; + + // + bool isFICrossedOverZero = + // + isCFIOverZero && + !isPFIOverZero + // + ; + + // + bool isFICrossedUnderZero = + // + isCFIUnderZero && + !isPFIUnderZero + // + ; + + // + // XHK ... + + // + XOHCL cSMHKBar; + cMarket.hk.SMAsOHCL( + cSMHKBar, + cIndex // + ); + + // + XOHCL pSMHKBar; + cMarket.hk.SMAsOHCL( + pSMHKBar, + pIndex // + ); + + // + bool isCSMHKBullish = cSMHKBar.IsBullish(); + bool isCSMHKBearish = cSMHKBar.IsBearish(); + + // + bool isPSMHKBullish = pSMHKBar.IsBullish(); + bool isPSMHKBearish = pSMHKBar.IsBearish(); + + // + bool isSMHKSwitchedToBullish = + // + isCSMHKBullish && + isPSMHKBearish + // + ; + + // + bool isSMHKSwitchedToBearish = + // + isCSMHKBearish && + isPSMHKBullish + // + ; + + // + // XTD ... + + // + double cTDBullish = tdHelper.GetBullish(cIndex); + double pTDBullish = tdHelper.GetBullish(pIndex); + + // + double cTDBearish = tdHelper.GetBearish(cIndex); + double pTDBearish = tdHelper.GetBearish(pIndex); + + // + bool isCTDBullish = + // + cTDBullish > cTDBearish + // + ; + + // + bool isCTDBearish = + // + cTDBearish > cTDBullish + // + ; + + // + bool isPTDBullish = + // + pTDBullish > pTDBearish + // + ; + + // + bool isPTDBearish = + // + pTDBearish > pTDBullish + // + ; + + // + bool isTDBullish = isCTDBullish; + bool isTDBearish = isCTDBearish; + bool isTDSwitchedToBullish = + // + isCTDBullish && + !isPTDBullish + // + ; + bool isTDSwitchedToBearsih = + // + isCTDBearish && + !isPTDBearish + // + ; + + // + // XDON ... + + // + XOHCL cBar = cMarket.GetBar(cIndex); + XOHCL pBar = cMarket.GetBar(pIndex); + + // + double cDONUpperOpen = cMarket.don.GetUpperO(cIndex); + double cDONUpperClose = cMarket.don.GetUpperC(cIndex); + double cDONUpperHigh = cMarket.don.GetUpperH(cIndex); + double cDONUpperLow = cMarket.don.GetUpperL(cIndex); + + // + double cDONLowerOpen = cMarket.don.GetLowerO(cIndex); + double cDONLowerClose = cMarket.don.GetLowerC(cIndex); + double cDONLowerHigh = cMarket.don.GetLowerH(cIndex); + double cDONLowerLow = cMarket.don.GetLowerL(cIndex); + + // + double pDONUpperOpen = cMarket.don.GetUpperO(pIndex); + double pDONUpperClose = cMarket.don.GetUpperC(pIndex); + double pDONUpperHigh = cMarket.don.GetUpperH(pIndex); + double pDONUpperLow = cMarket.don.GetUpperL(pIndex); + + // + double pDONLowerOpen = cMarket.don.GetLowerO(pIndex); + double pDONLowerClose = cMarket.don.GetLowerC(pIndex); + double pDONLowerHigh = cMarket.don.GetLowerH(pIndex); + double pDONLowerLow = cMarket.don.GetLowerL(pIndex); + + // + bool isBarCrossedDownDONLowerHigh = + // + cBar.IsBreakDown(pDONLowerHigh) + // + ; + + // + bool isBarCrossedUpDONLowerHigh = + // + cBar.IsBreakUp(pDONLowerHigh) + // + ; + + // + result = + // + isSMHKSwitchedToBullish + // isSMHKSwitchedToBearish + // isBarCrossedUpDONLowerHigh + // + ; + if (result) + { + Print("Salam"); + } + + // + if (result) { + r2r = 2; + sl = cDONLowerHigh; + } + + // + return result; diff --git a/Experts/x-test.x121ea.mq5 b/Experts/x-test.x121ea.mq5 index 32285db4..ba8e5f11 100644 --- a/Experts/x-test.x121ea.mq5 +++ b/Experts/x-test.x121ea.mq5 @@ -40,8 +40,8 @@ bool x121EAAllowShort = true; // Allow Short Trades int x121EAManageInterval = 0; // Manager Check Intervals Seconds int x121EAMaxAllowedPositions = 5; // Max Allowed Positions double x121EAMaxAllowedSpread = 0; // Max Allowed Spred for Opening Trades -double x121EAMinProfitPerTrade = 3; // Min Profit Per Trade based On Volume Factor (Hedge) -double x121EAMinProfitPerVolumeFactor = 0.01; // Min Volume Factor for Calculating Profit (Hedge) +double x121EAMinProfitPerTrade = 0; // Min Profit Per Trade based On Volume Factor (Hedge) +double x121EAMinProfitPerVolumeFactor = 0.0; // Min Volume Factor for Calculating Profit (Hedge) double x121EAMaxAllowedDrawdownFactor = 0.002; // Max Allowed Drawdown Factor // double x121EAVolume = 0.01; // Static Volume @@ -191,12 +191,12 @@ bool InitialEA() // // Define Signallers ... ENUM_X121_SIGNAL_PROVIDERS signallers[]; - // Add(X786, signallers); + Add(X786, signallers); // Add(X110, signallers); // Add(X121, signallers); // Add(X128, signallers); // Add(X92, signallers); - Add(XTEST, signallers); + // Add(XTEST, signallers); // GetAllX121SignalProviders(signallers); // @@ -300,7 +300,7 @@ void ConfigureDescriptor( // // XHK ... iDescriptor.inputs.hkInputs.drawHikenAshi = false; - iDescriptor.inputs.hkInputs.drawSmoothedHikenAshi = false; + iDescriptor.inputs.hkInputs.drawSmoothedHikenAshi = true; // // XMRB ... @@ -351,13 +351,13 @@ void ConfigureDescriptor( // // XDON ... iDescriptor.inputs.donInputs.showOpen = false; - iDescriptor.inputs.donInputs.showHigh = false; + iDescriptor.inputs.donInputs.showHigh = true; iDescriptor.inputs.donInputs.showClose = false; iDescriptor.inputs.donInputs.showLow = false; // // XSTR ... - iDescriptor.inputs.strInputs.showTrends = false; + iDescriptor.inputs.strInputs.showTrends = true; iDescriptor.inputs.strInputs.fillTrends = false; //