From d14f07ba80910b67a1bb777bece832f26cf7ef44 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sun, 9 Mar 2025 01:03:44 +0330 Subject: [PATCH] last ... --- Helpers/x-saherelm.x121.helper.mq5 | 46 ++- Helpers/x-saherelm.x121.xcc.helper.mq5 | 2 +- Helpers/x-saherelm.x121.xvwap.helper.mq5 | 2 +- .../x-121.smc.market.cycle.helper.class.mq5 | 369 ++++++++++++++++++ X121SMCEA/Experts/x-121.smc.expert.class.mq5 | 2 +- .../Signals/x-121.smc.xwz.signal.class.mq5 | 41 +- .../Signals/x-121.smc.xwz.signal.lib.mq5 | 108 ++++- .../Strategy/x-121.smc.strategy.class.mq5 | 34 +- 8 files changed, 573 insertions(+), 31 deletions(-) diff --git a/Helpers/x-saherelm.x121.helper.mq5 b/Helpers/x-saherelm.x121.helper.mq5 index f97ba868..7f82419b 100644 --- a/Helpers/x-saherelm.x121.helper.mq5 +++ b/Helpers/x-saherelm.x121.helper.mq5 @@ -24,6 +24,7 @@ // Imports ... #include "../Helpers/x-saherelm.x121.x3ma.helper.mq5" #include "../Helpers/x-saherelm.x121.xatr.helper.mq5" +#include "../Helpers/x-saherelm.x121.xcc.helper.mq5" #include "../Helpers/x-saherelm.x121.xche.helper.mq5" #include "../Helpers/x-saherelm.x121.xdon.helper.mq5" #include "../Helpers/x-saherelm.x121.xhk.helper.mq5" @@ -39,6 +40,7 @@ struct X121Inputs // // Props ... bool showRSI; + X121XCCInputs xccInputs; X121XPVInputs xpvInputs; X121XHKInputs xhkInputs; X121XATRInputs xatrInputs; @@ -65,6 +67,7 @@ struct X121Inputs void Clean() { // + xccInputs.Clean(); xpvInputs.Clean(); xhkInputs.Clean(); xatrInputs.Clean(); @@ -84,6 +87,7 @@ struct X121Inputs void Default() { // + xccInputs.Default(); xpvInputs.Default(); xhkInputs.Default(); xatrInputs.Default(); @@ -108,6 +112,7 @@ struct X121Inputs // result = // + xccInputs.IsValid() && xpvInputs.IsValid() && xhkInputs.IsValid() && xatrInputs.IsValid() && @@ -223,6 +228,8 @@ struct X121Conditions double xhkRawHighBuffer[]; double xhkSMCloseBuffer[]; double vwapVolumeBuffer[]; + double peaksGoldenBuffer[]; + double valesGoldenBuffer[]; double xhkRawCloseBuffer[]; double atrUpperRawBuffer[]; double atrLowerRawBuffer[]; @@ -623,11 +630,11 @@ struct X121Conditions Clean(adxBuffer); Clean(adxPBuffer); Clean(adxMBuffer); - Clean(volumeBuffer); Clean(peaksBuffer); Clean(valesBuffer); Clean(strUpBuffer); Clean(downTBuffer); + Clean(volumeBuffer); Clean(strDownBuffer); Clean(vwapMidBuffer); Clean(upTrendBuffer); @@ -654,6 +661,8 @@ struct X121Conditions Clean(xhkRawHighBuffer); Clean(xhkSMCloseBuffer); Clean(vwapVolumeBuffer); + Clean(peaksGoldenBuffer); + Clean(valesGoldenBuffer); Clean(xhkRawCloseBuffer); Clean(atrUpperRawBuffer); Clean(atrLowerRawBuffer); @@ -696,11 +705,11 @@ struct X121Conditions ArraySetAsSeries(adxBuffer, true); ArraySetAsSeries(adxPBuffer, true); ArraySetAsSeries(adxMBuffer, true); - ArraySetAsSeries(volumeBuffer, true); ArraySetAsSeries(peaksBuffer, true); ArraySetAsSeries(valesBuffer, true); ArraySetAsSeries(strUpBuffer, true); ArraySetAsSeries(downTBuffer, true); + ArraySetAsSeries(volumeBuffer, true); ArraySetAsSeries(strDownBuffer, true); ArraySetAsSeries(vwapMidBuffer, true); ArraySetAsSeries(upTrendBuffer, true); @@ -727,6 +736,8 @@ struct X121Conditions ArraySetAsSeries(xhkRawHighBuffer, true); ArraySetAsSeries(xhkSMCloseBuffer, true); ArraySetAsSeries(vwapVolumeBuffer, true); + ArraySetAsSeries(peaksGoldenBuffer, true); + ArraySetAsSeries(valesGoldenBuffer, true); ArraySetAsSeries(xhkRawCloseBuffer, true); ArraySetAsSeries(atrUpperRawBuffer, true); ArraySetAsSeries(atrLowerRawBuffer, true); @@ -2383,6 +2394,7 @@ class XCX121Helper : public XCBase // // Helpers ... + XCX121XCCHelper *xccHelper; XCX121XPVHelper *xpvHelper; XCX121XHKHelper *xhkHelper; XCX121XATRHelper *xatrHelper; @@ -2405,6 +2417,7 @@ class XCX121Helper : public XCBase { // mInputs.Clean(); + xccInputs.Clean(); xpvInputs.Clean(); xhkInputs.Clean(); xatrInputs.Clean(); @@ -2416,6 +2429,7 @@ class XCX121Helper : public XCBase xtrendInputs.Clean(); // + delete xccHelper; delete xpvHelper; delete xhkHelper; delete xatrHelper; @@ -2427,6 +2441,7 @@ class XCX121Helper : public XCBase delete xtrendHelper; // + ZeroMemory(xccHelper); ZeroMemory(xpvHelper); ZeroMemory(xhkHelper); ZeroMemory(xatrHelper); @@ -2490,6 +2505,7 @@ class XCX121Helper : public XCBase // mInputs = inputs; + xccInputs = inputs.xccInputs; xpvInputs = inputs.xpvInputs; xhkInputs = inputs.xhkInputs; xatrInputs = inputs.xatrInputs; @@ -2503,6 +2519,19 @@ class XCX121Helper : public XCBase // // Initial Helpers ... + // + // XCC ... + xccHelper = new XCX121XCCHelper(); + result = xccHelper.Init( + symbol, + period, + xccInputs // + ); + if (!result) + { + return result; + } + // // XPV ... xpvHelper = new XCX121XPVHelper(); @@ -3086,6 +3115,18 @@ class XCX121Helper : public XCBase conditions.valesBuffer // ); + // + Copy( + xpvConditions.peaksGoldenBuffer, + conditions.peaksGoldenBuffer // + ); + + // + Copy( + xpvConditions.valesGoldenBuffer, + conditions.valesGoldenBuffer // + ); + // Copy( xpvConditions.sarBuffer, @@ -4447,6 +4488,7 @@ class XCX121Helper : public XCBase // // Inputs ... X121Inputs mInputs; + X121XCCInputs xccInputs; X121XPVInputs xpvInputs; X121XHKInputs xhkInputs; X121XATRInputs xatrInputs; diff --git a/Helpers/x-saherelm.x121.xcc.helper.mq5 b/Helpers/x-saherelm.x121.xcc.helper.mq5 index bcef12ea..1663ae72 100644 --- a/Helpers/x-saherelm.x121.xcc.helper.mq5 +++ b/Helpers/x-saherelm.x121.xcc.helper.mq5 @@ -195,8 +195,8 @@ class XCX121XCCHelper : public XCBaseHelper mInputs.upColor, // Up Color mInputs.downColor, // Down Color mInputs.lineColor, // Line mode and Doji candlestick Color - mInputs.bearishColor, // Bullish Color mInputs.bullishColor, // Bearish Color + mInputs.bearishColor, // Bullish Color mInputs.volumesColor, // Volumes Color // // Presentation ... diff --git a/Helpers/x-saherelm.x121.xvwap.helper.mq5 b/Helpers/x-saherelm.x121.xvwap.helper.mq5 index 4f7a4efa..99f3a1bc 100644 --- a/Helpers/x-saherelm.x121.xvwap.helper.mq5 +++ b/Helpers/x-saherelm.x121.xvwap.helper.mq5 @@ -110,7 +110,7 @@ struct X121XVWAPInputs // vwapFastLength = 20; vwapMidLength = 50; - vwapSlowLength = 100; + vwapSlowLength = 200; vwapAppliedTo = PRICE_CLOSE; // diff --git a/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 b/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 index da8f3653..d864f9dd 100644 --- a/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 +++ b/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 @@ -681,6 +681,375 @@ class XC121SMCCycleHelper : public XCBase // }; +// +struct X121SMCStrategyConditionParser +{ + // + // Props ... + + // + // XSAR ... + + // + bool isSarBullishOverPeaksGoldenZone; + bool isSarSwitchedToBullishOverPeaksGoldenZone; + bool isSarBearishOverPeaksGoldenZone; + bool isSarSwitchedToBearishOverPeaksGoldenZone; + bool isSarBullishUnderValesGoldenZone; + bool isSarSwitchedToBullishUnderValesGoldenZone; + bool isSarBearishUnderValesGoldenZone; + bool isSarSwitchedToBearishUnderValesGoldenZone; + + // + // XMA ... + + // + bool isX3MaFastUnderValesGoldenZone; + bool isX3MaFastCrossedUnderValesGoldenZone; + bool isX3MaFastOverPeaksGoldenZone; + bool isX3MaFastCrossedOverPeaksGoldenZone; + + // + bool isX3MaInsidePeaksGoldenZone; + bool isX3MaCrossedInsidePeaksGoldenZone; + + // + bool isX3MaInsideValesGoldenZone; + bool isX3MaCrossedInsideValesGoldenZone; + + // + // XVWAP ... + + // + bool isVWapFastUnderValesGoldenZone; + bool isVWapFastCrossedUnderValesGoldenZone; + bool isVWapFastOverPeaksGoldenZone; + bool isVWapFastCrossedOverPeaksGoldenZone; + + // + // XHK ... + + // + // XRWHK ... + + // + bool isRawHKBearishOverPeaksGoldenZone; + bool isRawHKSwitchedToBearishOverPeaksGoldenZone; + bool isRawHKBullishUnderValesGoldenZone; + bool isRawHKSwitchedToBullishUnderValesGoldenZone; + + // + // XSMHK ... + + // + bool isSMHKBearishOverPeaksGoldenZone; + bool isSMHKSwitchedToBearishOverPeaksGoldenZone; + bool isSMHKBullishUnderValesGoldenZone; + bool isSMHKSwitchedToBullishUnderValesGoldenZone; + + // + bool isXVwapMaOverPeaksGoldeZone; + bool isXVwapMaUnderValesGoldeZone; + + // + // Constructor ... + X121SMCStrategyConditionParser() + { + Clean(); + } + + // + // Tools ... + + // + void Clean() + { + // + isSarBullishOverPeaksGoldenZone = false; + isSarSwitchedToBullishOverPeaksGoldenZone = false; + isSarBearishOverPeaksGoldenZone = false; + isSarSwitchedToBearishOverPeaksGoldenZone = false; + isSarBullishUnderValesGoldenZone = false; + isSarSwitchedToBullishUnderValesGoldenZone = false; + isSarBearishUnderValesGoldenZone = false; + isSarSwitchedToBearishUnderValesGoldenZone = false; + + // + isX3MaFastUnderValesGoldenZone = false; + isX3MaFastCrossedUnderValesGoldenZone = false; + isX3MaFastOverPeaksGoldenZone = false; + isX3MaFastCrossedOverPeaksGoldenZone = false; + + // + isX3MaInsidePeaksGoldenZone = false; + isX3MaCrossedInsidePeaksGoldenZone = false; + + // + isX3MaInsideValesGoldenZone = false; + isX3MaCrossedInsideValesGoldenZone = false; + + // + isVWapFastUnderValesGoldenZone = false; + isVWapFastCrossedUnderValesGoldenZone = false; + isVWapFastOverPeaksGoldenZone = false; + isVWapFastCrossedOverPeaksGoldenZone = false; + + // + isRawHKBearishOverPeaksGoldenZone = false; + isRawHKSwitchedToBearishOverPeaksGoldenZone = false; + isRawHKBullishUnderValesGoldenZone = false; + isRawHKSwitchedToBullishUnderValesGoldenZone = false; + + // + isSMHKBearishOverPeaksGoldenZone = false; + isSMHKSwitchedToBearishOverPeaksGoldenZone = false; + isSMHKBullishUnderValesGoldenZone = false; + isSMHKSwitchedToBullishUnderValesGoldenZone = false; + + // + isXVwapMaOverPeaksGoldeZone = false; + isXVwapMaUnderValesGoldeZone = false; + + // + ZeroMemory(this); + } + + // + void Parse( + X121Conditions &conditions // + ) + { + // + Clean(); + + // + // + int zIDX = 0; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + + // + // XSAR ... + + // + isSarBullishOverPeaksGoldenZone = + conditions.isSarBullish && + conditions.sarBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSarSwitchedToBullishOverPeaksGoldenZone = + conditions.isSarSwitchedToBullish && + conditions.sarBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSarBearishOverPeaksGoldenZone = + conditions.isSarBearish && + conditions.sarBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSarSwitchedToBearishOverPeaksGoldenZone = + conditions.isSarSwitchedToBearish && + conditions.sarBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSarBullishUnderValesGoldenZone = + conditions.isSarBullish && + conditions.sarBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isSarSwitchedToBullishUnderValesGoldenZone = + conditions.isSarSwitchedToBullish && + conditions.sarBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isSarBearishUnderValesGoldenZone = + conditions.isSarBearish && + conditions.sarBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isSarSwitchedToBearishUnderValesGoldenZone = + conditions.isSarSwitchedToBearish && + conditions.sarBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + // X3MA ... + + // + isX3MaFastUnderValesGoldenZone = + conditions.x3maFastBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isX3MaFastCrossedUnderValesGoldenZone = + isX3MaFastUnderValesGoldenZone && + conditions.x3maFastBuffer[pIDX] >= conditions.valesGoldenBuffer[pIDX]; + + // + isX3MaFastOverPeaksGoldenZone = + conditions.x3maFastBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isX3MaFastCrossedOverPeaksGoldenZone = + isX3MaFastOverPeaksGoldenZone && + conditions.x3maFastBuffer[pIDX] <= conditions.peaksGoldenBuffer[pIDX]; + + // + isX3MaInsidePeaksGoldenZone = + // + conditions.x3maMin < conditions.peaksBuffer[cIDX] && + conditions.x3maMin > conditions.peaksGoldenBuffer[cIDX] && + // + conditions.x3maMax < conditions.peaksBuffer[cIDX] && + conditions.x3maMax > conditions.peaksGoldenBuffer[cIDX] + // + ; + + // + isX3MaCrossedInsidePeaksGoldenZone = + isX3MaInsidePeaksGoldenZone && + !( + // + conditions.x3maMin < conditions.peaksBuffer[pIDX] && + conditions.x3maMin > conditions.peaksGoldenBuffer[pIDX] && + // + conditions.x3maMax < conditions.peaksBuffer[pIDX] && + conditions.x3maMax > conditions.peaksGoldenBuffer[pIDX] + // + ); + + // + isX3MaInsideValesGoldenZone = + // + conditions.x3maMin > conditions.valesBuffer[cIDX] && + conditions.x3maMin < conditions.valesGoldenBuffer[cIDX] && + // + conditions.x3maMax > conditions.valesBuffer[cIDX] && + conditions.x3maMax < conditions.valesGoldenBuffer[cIDX] + // + ; + + isX3MaCrossedInsideValesGoldenZone = + isX3MaInsideValesGoldenZone && + !( + // + conditions.x3maMin > conditions.valesBuffer[pIDX] && + conditions.x3maMin < conditions.valesGoldenBuffer[pIDX] && + // + conditions.x3maMax > conditions.valesBuffer[pIDX] && + conditions.x3maMax < conditions.valesGoldenBuffer[pIDX] + // + ); + + // + // XVWAP ... + + // + isVWapFastUnderValesGoldenZone = + conditions.vwapFastBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isVWapFastCrossedUnderValesGoldenZone = + isVWapFastUnderValesGoldenZone && + conditions.vwapFastBuffer[pIDX] >= conditions.valesGoldenBuffer[pIDX]; + + // + isVWapFastOverPeaksGoldenZone = + conditions.vwapFastBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isVWapFastCrossedOverPeaksGoldenZone = + isVWapFastOverPeaksGoldenZone && + conditions.vwapFastBuffer[pIDX] <= conditions.peaksGoldenBuffer[pIDX]; + + // + // XHK ... + + // + // XRWHK ... + + // + isRawHKBearishOverPeaksGoldenZone = + conditions.isRawHKBearish && + conditions.xhkRawHighBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isRawHKSwitchedToBearishOverPeaksGoldenZone = + conditions.isRawHKSwitchedToBearish && + conditions.xhkRawHighBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isRawHKBullishUnderValesGoldenZone = + conditions.isRawHKBullish && + conditions.xhkRawLowBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isRawHKSwitchedToBullishUnderValesGoldenZone = + conditions.isRawHKSwitchedToBullish && + conditions.xhkRawLowBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + // XSMHK ... + + // + isSMHKBearishOverPeaksGoldenZone = + conditions.isSMHKBearish && + conditions.xhkSMHighBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSMHKSwitchedToBearishOverPeaksGoldenZone = + conditions.isSMHKSwitchedToBearish && + conditions.xhkSMHighBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSMHKBullishUnderValesGoldenZone = + conditions.isSMHKBullish && + conditions.xhkSMLowBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isSMHKSwitchedToBullishUnderValesGoldenZone = + conditions.isSMHKSwitchedToBullish && + conditions.xhkSMLowBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + // COMBINED Conditions ... + + // + isXVwapMaOverPeaksGoldeZone = + // + ( + // + (isX3MaFastOverPeaksGoldenZone && + isVWapFastCrossedOverPeaksGoldenZone) + // + || + // + (isVWapFastOverPeaksGoldenZone && + isX3MaFastCrossedOverPeaksGoldenZone) + // + ) + // + ; + + // + isXVwapMaUnderValesGoldeZone = + // + ( + // + (isX3MaFastUnderValesGoldenZone && + isVWapFastCrossedUnderValesGoldenZone) + // + || + // + (isVWapFastUnderValesGoldenZone && + isX3MaFastCrossedUnderValesGoldenZone) + // + ) + // + ; + } + + // +}; + // struct X121SMCStrategySignalProviderData { diff --git a/X121SMCEA/Experts/x-121.smc.expert.class.mq5 b/X121SMCEA/Experts/x-121.smc.expert.class.mq5 index c79eaa1a..3405a238 100644 --- a/X121SMCEA/Experts/x-121.smc.expert.class.mq5 +++ b/X121SMCEA/Experts/x-121.smc.expert.class.mq5 @@ -63,7 +63,7 @@ class XC121SMCExpert : public XCBaseExpert // Constructor(s) ... XC121SMCExpert() { - mShowCandles = false; + mShowCandles = true; } // diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 index ee6631bb..1bfe54e9 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 @@ -216,9 +216,9 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Detect Zones and Boxes ... - hasWaitingZones = workingZone.DetectZone( - provider // - ); + // hasWaitingZones = workingZone.DetectZone( + // provider // + // ); // hasWaitingBoxes = workingZone.HasWaitingBoxes(); @@ -281,18 +281,18 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Detect Signal Box ... - // - bool isZoneActivated = - hasWorkingZone && - hasWaitingZones && - workingZone.IsZoneActivated( - activatedZoneIDX, - activatedFVGIDX, - signalBoxDir, - signalProvider, - provider, - zIndex // - ); + // // + // bool isZoneActivated = + // hasWorkingZone && + // hasWaitingZones && + // workingZone.IsZoneActivated( + // activatedZoneIDX, + // activatedFVGIDX, + // signalBoxDir, + // signalProvider, + // provider, + // zIndex // + // ); // // hasSignalBox = @@ -306,6 +306,17 @@ class XCX121SMCXWZSignalDetector : public XCBase // zIndex // // ); + // + hasSignalBox = + hasWorkingZone && + workingZone.DetectSignalConditions( + signalBox, + signalBoxDir, + signalProvider, + provider, + zIndex // + ); + // if (hasSignalBox) { diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 index 9ff3873e..83cfaa1f 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 @@ -1061,7 +1061,7 @@ struct X121SMCStrategyXWZWorkingZone // result = isPVPassed; - + if (result) { // @@ -1124,7 +1124,7 @@ struct X121SMCStrategyXWZWorkingZone bool IsBoxActivated( XBoxZone &box, ENUM_X_DIRECTION &dir, - ENUM_X121SMC_XWZ_PROVIDERS &signalProviderl, + ENUM_X121SMC_XWZ_PROVIDERS &signalProvider, X121SMCStrategySignalProviderData &provider, int barIndex = 0 // ) @@ -1135,7 +1135,7 @@ struct X121SMCStrategyXWZWorkingZone // box.Clean(); dir = X_DIRECTION_NONE; - signalProviderl = X121SMC_XWZ_PROVIDER_NONE; + signalProvider = X121SMC_XWZ_PROVIDER_NONE; // if (barIndex < 0) @@ -1428,7 +1428,7 @@ struct X121SMCStrategyXWZWorkingZone // box = iBox; dir = iBox.dir; - signalProviderl = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX; + signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX; // iBox.Clean(); @@ -1590,7 +1590,7 @@ struct X121SMCStrategyXWZWorkingZone isTrendBullish ? X_DIRECTION_BULLISH : X_DIRECTION_BEARISH; - signalProviderl = X121SMC_XWZ_PROVIDER_ACTIVATED_MA; + signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_MA; break; } @@ -1842,7 +1842,7 @@ struct X121SMCStrategyXWZWorkingZone // dir = X_DIRECTION_BEARISH; - signalProviderl = X121SMC_XWZ_PROVIDER_ACTIVATED_AREA; + signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_AREA; // iBox.Clean(); @@ -1946,7 +1946,7 @@ struct X121SMCStrategyXWZWorkingZone // dir = X_DIRECTION_BULLISH; - signalProviderl = X121SMC_XWZ_PROVIDER_ACTIVATED_AREA; + signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_AREA; // iBox.Clean(); @@ -1986,6 +1986,100 @@ struct X121SMCStrategyXWZWorkingZone return result; } + // + bool DetectSignalConditions( + XBoxZone &box, + ENUM_X_DIRECTION &dir, + ENUM_X121SMC_XWZ_PROVIDERS &signalProvider, + X121SMCStrategySignalProviderData &provider, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + // Normalize Bars ... + + // + box.Clean(); + dir = X_DIRECTION_NONE; + signalProvider = X121SMC_XWZ_PROVIDER_NONE; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + result = IsValid(); + if (!result) + { + return result; + } + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + + // + // Initial Bars ... + result = zBar.Init( + symbol, + period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + + // + return result; + } + + // + // Detecting Signal Conditions ... + X121SMCStrategyConditionParser decisionParser; + decisionParser.Parse(provider.decisionXConditions); + + // + bool has = + // + // false + decisionParser.isX3MaCrossedInsideValesGoldenZone + // + ; + if (has) + { + Print("Condition ..."); + } + + // + // Senario 1: + // ---------- + + // + + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + + // + return result; + } + // bool IsExists(XOBFVG &zone) { diff --git a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 index eab17ada..d9a07013 100644 --- a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 +++ b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 @@ -754,6 +754,32 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy x121Inputs.xatrInputs.atrMultiplier = 1.5; x121Inputs.xatrInputs.atrSmoothingMode = X_MA_MODE_EMA; + // + x121Inputs.xvwapInputs.vwapFastLength = 20; + x121Inputs.xvwapInputs.vwapMidLength = 50; + x121Inputs.xvwapInputs.vwapSlowLength = 200; + + // + x121Inputs.x3maInputs.x3maFastMALength = 20; + x121Inputs.x3maInputs.x3maMidMALength = 50; + x121Inputs.x3maInputs.x3maSlowMALength = 200; + + // + // x121Inputs.xccInputs.upColor = clrLime; + // x121Inputs.xccInputs.downColor = clrRed; + // x121Inputs.xccInputs.lineColor = CLR_NONE; + // x121Inputs.xccInputs.bearishColor = clrRed; + // x121Inputs.xccInputs.bullishColor = clrLime; + // x121Inputs.xccInputs.volumesColor = clrGreen; + + // + // + // + + // + // XCC ... + x121Inputs.xccInputs.showCandles = showAll || false; + // // XTREND ... x121Inputs.xtrendInputs.showUpTrend = showAll || false; @@ -772,7 +798,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // x121Inputs.xhkInputs.drawRawXHKCandles = showAll || false; - x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || true; + x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || false; // // XATR ... @@ -807,9 +833,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // // X3MA ... - x121Inputs.x3maInputs.showX3MaFast = showAll || false; - x121Inputs.x3maInputs.showX3MaMid = showAll || false; - x121Inputs.x3maInputs.showX3MaSlow = showAll || false; + x121Inputs.x3maInputs.showX3MaFast = showAll || true; + x121Inputs.x3maInputs.showX3MaMid = showAll || true; + x121Inputs.x3maInputs.showX3MaSlow = showAll || true; // // Initialize Cycle Helpers ...