From 4e4be34f1ab71a7d218b7b6b6f1eeb6918628fbf Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Fri, 31 May 2024 22:16:15 +0330 Subject: [PATCH] last works ... --- Classes/x-saherelm.x121.provider.class.mq5 | 267 +++++++++++++-------- Classes/x-saherelm.x121.xmcycle.class.mq5 | 79 +++++- Experts/x-test.x121ea.mq5 | 4 +- 3 files changed, 251 insertions(+), 99 deletions(-) diff --git a/Classes/x-saherelm.x121.provider.class.mq5 b/Classes/x-saherelm.x121.provider.class.mq5 index 25a9c31d..4eaa6af4 100644 --- a/Classes/x-saherelm.x121.provider.class.mq5 +++ b/Classes/x-saherelm.x121.provider.class.mq5 @@ -3696,91 +3696,11 @@ private: bool hHasX786 = hMarket.HasX786LongConditions(); // - if (cHasX786) - { - sl = cMarket.don.GetLowerH(cIndex); - } - else if (sHasX786) - { - sl = sMarket.don.GetLowerH(cIndex); - } - else if (mHasX786) - { - sl = mMarket.don.GetLowerH(cIndex); - } - else if (lHasX786) - { - sl = lMarket.don.GetLowerH(cIndex); - } - else if (hHasX786) - { - sl = hMarket.don.GetLowerH(cIndex); - } - - // - result = - // - cHasX786 - // - && - // - sHasX786 - // - && - // - mHasX786 - // - && - // - lHasX786 - // - // && - // // - // hHasX786 - // - ; - - // - if (result) - { - // - r2r = 1; - sl = cMarket.don.GetLowerH(cIndex); - } - - // - return result; - } - - // - bool X786HasSpecifiedShortSignal( - X121MarketConditions &mConditions, // - double &sl, // Provided SL ... - double &tp, // Provided TP ... - double &r2r // Risk Reward Ratio ... - ) - { - // - bool result = false; - - // - int zIndex = 0; - int cIndex = zIndex + 1; - int pIndex = cIndex + 1; - - // - bool cHasX786 = cMarket.HasX786ShortConditions(); - bool sHasX786 = sMarket.HasX786ShortConditions(); - bool mHasX786 = mMarket.HasX786ShortConditions(); - bool lHasX786 = lMarket.HasX786ShortConditions(); - bool hHasX786 = hMarket.HasX786ShortConditions(); - - // - double cMarketSLe = cMarket.don.GetUpperL(cIndex); - double sMarketSLe = sMarket.don.GetUpperL(cIndex); - double mMarketSLe = mMarket.don.GetUpperL(cIndex); - double lMarketSLe = lMarket.don.GetUpperL(cIndex); - double hMarketSLe = hMarket.don.GetUpperL(cIndex); + double cMarketSL = cMarket.don.GetLowerH(cIndex); + double sMarketSL = sMarket.don.GetLowerH(cIndex); + double mMarketSL = mMarket.don.GetLowerH(cIndex); + double lMarketSL = lMarket.don.GetLowerH(cIndex); + double hMarketSL = hMarket.don.GetLowerH(cIndex); // bool condition1 = @@ -3834,9 +3754,9 @@ private: { // double sls[] = { - cMarketSLe, - sMarketSLe, - mMarketSLe // + cMarketSL, + sMarketSL, + mMarketSL // }; // @@ -3846,9 +3766,9 @@ private: { // double sls[] = { - sMarketSLe, - mMarketSLe, - lMarketSLe // + sMarketSL, + mMarketSL, + lMarketSL // }; // @@ -3858,9 +3778,9 @@ private: { // double sls[] = { - mMarketSLe, - lMarketSLe, - hMarketSLe // + mMarketSL, + lMarketSL, + hMarketSL // }; // @@ -3870,8 +3790,163 @@ private: { // double sls[] = { - lMarketSLe, - hMarketSLe // + lMarketSL, + hMarketSL // + }; + + // + sl = GetAverage(sls); + } + + // + result = + // + condition1 + // + || + // + condition2 + // + || + // + condition3 + // + || + // + condition4 + // + ; + + // + if (result) + { + r2r = 1; + } + + // + return result; + } + + // + bool X786HasSpecifiedShortSignal( + X121MarketConditions &mConditions, // + double &sl, // Provided SL ... + double &tp, // Provided TP ... + double &r2r // Risk Reward Ratio ... + ) + { + // + bool result = false; + + // + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + + // + bool cHasX786 = cMarket.HasX786ShortConditions(); + bool sHasX786 = sMarket.HasX786ShortConditions(); + bool mHasX786 = mMarket.HasX786ShortConditions(); + bool lHasX786 = lMarket.HasX786ShortConditions(); + bool hHasX786 = hMarket.HasX786ShortConditions(); + + // + double cMarketSL = cMarket.don.GetUpperL(cIndex); + double sMarketSL = sMarket.don.GetUpperL(cIndex); + double mMarketSL = mMarket.don.GetUpperL(cIndex); + double lMarketSL = lMarket.don.GetUpperL(cIndex); + double hMarketSL = hMarket.don.GetUpperL(cIndex); + + // + bool condition1 = + // + ((cHasX786 && + sHasX786) + // + || + // + (cHasX786 && + mHasX786)) + // + ; + + // + bool condition2 = + // + ((sHasX786 && + mHasX786) + // + || + // + (sHasX786 && + lHasX786)) + // + ; + + // + bool condition3 = + // + ((mHasX786 && + lHasX786) + // + || + // + (mHasX786 && + hHasX786)) + // + ; + + // + bool condition4 = + // + (lHasX786 && + hHasX786) + // + ; + + // + if (condition1) + { + // + double sls[] = { + cMarketSL, + sMarketSL, + mMarketSL // + }; + + // + sl = GetAverage(sls); + } + else if (condition2) + { + // + double sls[] = { + sMarketSL, + mMarketSL, + lMarketSL // + }; + + // + sl = GetAverage(sls); + } + else if (condition3) + { + // + double sls[] = { + mMarketSL, + lMarketSL, + hMarketSL // + }; + + // + sl = GetAverage(sls); + } + else if (condition4) + { + // + double sls[] = { + lMarketSL, + hMarketSL // }; // diff --git a/Classes/x-saherelm.x121.xmcycle.class.mq5 b/Classes/x-saherelm.x121.xmcycle.class.mq5 index a7b94bd1..96e101c7 100644 --- a/Classes/x-saherelm.x121.xmcycle.class.mq5 +++ b/Classes/x-saherelm.x121.xmcycle.class.mq5 @@ -828,6 +828,8 @@ public: Clean(ichChikouSpans); Clean(ichSenkouSpanAs); Clean(ichSenkouSpanBs); + Clean(ichFutureSenkouSpanAs); + Clean(ichFutureSenkouSpanBs); Clean(mcFasts); Clean(mcSlows); Clean(mcVerifiers); @@ -907,6 +909,8 @@ public: ArraySetAsSeries(ichChikouSpans, true); ArraySetAsSeries(ichSenkouSpanAs, true); ArraySetAsSeries(ichSenkouSpanBs, true); + ArraySetAsSeries(ichFutureSenkouSpanAs, true); + ArraySetAsSeries(ichFutureSenkouSpanBs, true); ArraySetAsSeries(mcFasts, true); ArraySetAsSeries(mcSlows, true); ArraySetAsSeries(mcVerifiers, true); @@ -972,6 +976,9 @@ public: ArraySetAsSeries(pvLCLLs, true); ArraySetAsSeries(pvHCHHs, true); ArraySetAsSeries(pvHCLLs, true); + ArraySetAsSeries(tdBullishs, true); + ArraySetAsSeries(tdBearishs, true); + ArraySetAsSeries(tdSignals, true); // // XZG ... @@ -3567,7 +3574,42 @@ public: bool HasX786LongConditions() { // - bool result; + bool result = false; + + // + X121MCycleConditions conditions; + GetMarketConditions(conditions); + + // + 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)) + // + ; // return result; @@ -3580,6 +3622,41 @@ public: // bool result = false; + // + X121MCycleConditions conditions; + GetMarketConditions(conditions); + + // + 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)) + // + ; + // return result; } diff --git a/Experts/x-test.x121ea.mq5 b/Experts/x-test.x121ea.mq5 index fe7c1631..bd97c9ce 100644 --- a/Experts/x-test.x121ea.mq5 +++ b/Experts/x-test.x121ea.mq5 @@ -238,8 +238,8 @@ bool InitialEA() iDescriptor.symbol = iSymbol; iDescriptor.period = iPeriod; iDescriptor.staticVolume = x121EAVolume; - iDescriptor.allowLong = false; // x121EAAllowLong; - iDescriptor.allowShort = x121EAAllowShort; + iDescriptor.allowLong = x121EAAllowLong; + iDescriptor.allowShort = false; // x121EAAllowShort; Copy( signallers, iDescriptor.signallers);