From 0f9ab4b61ad3266c472371760f2bab8f35dc7556 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 24 Feb 2025 00:24:13 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.x-cobject.class.mq5 | 2 +- Documents/BKP/xsupdem/plib.tmp.codes.mq5 | 62 ++ Helpers/x-saherelm.x121.helper.mq5 | 370 +++++++ Indicators/x-saherelm.x121.xwz.mq5 | 423 +++++++- .../Signals/x-121.smc.xwz.signal.class.mq5 | 947 +++++++++++++----- .../Signals/x-121.smc.xwz.signal.lib.mq5 | 20 + .../Strategy/x-121.smc.strategy.class.mq5 | 6 +- 7 files changed, 1548 insertions(+), 282 deletions(-) diff --git a/Classes/x-saherelm.x-cobject.class.mq5 b/Classes/x-saherelm.x-cobject.class.mq5 index 0dc8f05e..e1752eed 100644 --- a/Classes/x-saherelm.x-cobject.class.mq5 +++ b/Classes/x-saherelm.x-cobject.class.mq5 @@ -2592,7 +2592,7 @@ class XCRRObject : public XCBaseObject // datetime time1 = rr.time; - datetime time2 = (datetime)((int)rr.time + 2 * PeriodSeconds(rr.period)); + datetime time2 = (datetime)((int)rr.time + 5 * PeriodSeconds(rr.period)); // result = mFibo.Create( diff --git a/Documents/BKP/xsupdem/plib.tmp.codes.mq5 b/Documents/BKP/xsupdem/plib.tmp.codes.mq5 index 255d6b67..f99ce31e 100644 --- a/Documents/BKP/xsupdem/plib.tmp.codes.mq5 +++ b/Documents/BKP/xsupdem/plib.tmp.codes.mq5 @@ -2668,3 +2668,65 @@ bool IsReject( // // // longSLBuffer[bar_index] = iLongSL; // shortSLBuffer[bar_index] = iShortSL; + + + /////////////////////////////////////////////////// + + // + // Draw ... + bool isBullish = signalZone.ob.IsBullish(); + bool isCreated = false; + XCBaseObject *iObj = NULL; + if (isBullish) + { + // + XCBullishOrderBlockObject *mObj; + isCreated = visionCycleHelper.mPOIDrawer + .CreateBullishOrderBlock( + signalZone.ob, + mObj // + ); + + // + if (isCreated) + { + // + mObj.ZoneWidth(2); + mObj.ZoneColor(clrGold); + mObj.ZoneStyle(STYLE_SOLID); + + // + iObj = (XCBaseObject *)mObj; + } + } + else + { + // + XCBearishOrderBlockObject *mObj; + isCreated = visionCycleHelper.mPOIDrawer + .CreateBearishOrderBlock( + signalZone.ob, + mObj // + ); + + // + if (isCreated) + { + // + mObj.ZoneWidth(2); + mObj.ZoneColor(clrGold); + mObj.ZoneStyle(STYLE_SOLID); + + // + iObj = (XCBaseObject *)mObj; + } + } + + // + if (isCreated) + { + mWorkingZoneObjects.Add(iObj); + } + + // + Print("Signal Zone ..."); diff --git a/Helpers/x-saherelm.x121.helper.mq5 b/Helpers/x-saherelm.x121.helper.mq5 index 5800ec25..4b83e11e 100644 --- a/Helpers/x-saherelm.x121.helper.mq5 +++ b/Helpers/x-saherelm.x121.helper.mq5 @@ -1170,6 +1170,376 @@ struct X121Conditions // bullishScore = 0; bearishScore = 0; + + // + double minScore = 0.5; + double score = 1; + double highScore = 1.5; + + // + // SLOPES ... + + // + if (isRsiSlopeBullish) + { + bullishScore += minScore; + } + if (isStrSlopeBullish) + { + bullishScore += minScore; + } + if (isAtrUpperSlopeBullish) + { + bullishScore += minScore; + } + if (isAtrLowerSlopeBullish) + { + bullishScore += minScore; + } + if (isVwapFastSlopeBullish) + { + bullishScore += minScore; + } + if (isVwapMidSlopeBullish) + { + bullishScore += minScore; + } + if (isVwapSlowSlopeBullish) + { + bullishScore += minScore; + } + + // + if (isRsiSlopeBearish) + { + bearishScore += minScore; + } + if (isStrSlopeBearish) + { + bearishScore += minScore; + } + if (isAtrUpperSlopeBearish) + { + bearishScore += minScore; + } + if (isAtrLowerSlopeBearish) + { + bearishScore += minScore; + } + if (isVwapFastSlopeBearish) + { + bearishScore += minScore; + } + if (isVwapMidSlopeBearish) + { + bearishScore += minScore; + } + if (isVwapSlowSlopeBearish) + { + bearishScore += minScore; + } + + // + // COMPLEX ... + + // + if (isRsiOverSold) + { + bullishScore += score; + } + if (isRsiCrossedUnderOverSold) + { + bullishScore += highScore; + } + + // + if (isRsiOverBought) + { + bearishScore += score; + } + if (isRsiCrossedOverOverBought) + { + bearishScore += highScore; + } + + // + // TODO: ... + // there many other complex conditions which may used lter ... + // + + // + // XTREND ... + + // + if (isTrendBullish) + { + bullishScore += minScore; + } + if (isTrendSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isTrendBearish) + { + bearishScore += minScore; + } + if (isTrendSwitchedToBearish) + { + bearishScore += score; + } + + // + // XSAR ... + + // + if (isSarBullish) + { + bullishScore += minScore; + } + if (isSarSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isSarBearish) + { + bearishScore += minScore; + } + if (isSarSwitchedToBearish) + { + bearishScore += score; + } + + // + // XSTR ... + + // + if (isStrBullish) + { + bullishScore += minScore; + } + if (isStrSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isStrBearish) + { + bearishScore += minScore; + } + if (isStrSwitchedToBearish) + { + bearishScore += score; + } + + // + // XCHE ... + + // + if (isCheBullish) + { + bullishScore += score; + } + if (isCheSwitchedToBullish) + { + bullishScore += highScore; + } + if (isChe1Bullish && + !isCheBullish && + !isCheSwitchedToBullish) + { + bullishScore += minScore; + } + if (isChe1SwitchedToBullish && + !isCheBullish && + !isCheSwitchedToBullish) + { + bullishScore += minScore; + } + + // + if (isCheBearish) + { + bearishScore += score; + } + if (isCheSwitchedToBearish) + { + bearishScore += highScore; + } + if (isChe1Bearish && + !isCheBearish && + !isCheSwitchedToBearish) + { + bearishScore += minScore; + } + if (isChe1SwitchedToBearish && + !isCheBearish && + !isCheSwitchedToBearish) + { + bearishScore += minScore; + } + + // + // XVWAP ... + + // + if (isVWapBullishState) + { + bullishScore += score; + } + if (isVWapBullishOrdered) + { + bullishScore += score; + } + if (isVWapSwitchedToBullishState) + { + bullishScore += highScore; + } + if (isVWapSwitchedToBullishOrdered) + { + bullishScore += highScore; + } + if (!isVWapBullishState && + !isVWapSwitchedToBullishState) + { + // + if (isVWapFastBullish) + { + bullishScore += minScore; + } + if (isVWapSlowBullish) + { + bullishScore += minScore; + } + } + if (!isVWapBullishOrdered && + !isVWapSwitchedToBullishOrdered) + { + // + if (isVWapFastOverMid) + { + bullishScore += minScore; + } + if (isVWapMidOverSlow) + { + bullishScore += minScore; + } + } + + // + if (isVWapBearishState) + { + bearishScore += score; + } + if (isVWapBearishOrdered) + { + bearishScore += score; + } + if (isVWapSwitchedToBearishState) + { + bearishScore += highScore; + } + if (isVWapSwitchedToBearishOrdered) + { + bearishScore += highScore; + } + if (!isVWapBearishState && + !isVWapSwitchedToBearishState) + { + // + if (isVWapFastBearish) + { + bearishScore += minScore; + } + if (isVWapSlowBearish) + { + bearishScore += minScore; + } + } + if (!isVWapBearishOrdered && + !isVWapSwitchedToBearishOrdered) + { + // + if (isVWapFastUnderMid) + { + bearishScore += minScore; + } + if (isVWapMidUnderSlow) + { + bearishScore += minScore; + } + } + + // + // XSMHK ... + + // + if (isSMHKBullish) + { + bullishScore += minScore; + } + if (isRawHKBullish) + { + bullishScore += minScore; + } + if (isClosedOverSMHK) + { + bullishScore += minScore; + } + if (isClosedOverRawHK) + { + bullishScore += minScore; + } + if (isRawHKClosedOverSMHK) + { + bullishScore += minScore; + } + if (isSMHKSwitchedToBullish) + { + bullishScore += highScore; + } + if (isRawHKSwitchedToBullish) + { + bullishScore += highScore; + } + + // + if (isSMHKBearish) + { + bearishScore += minScore; + } + if (isRawHKBearish) + { + bearishScore += minScore; + } + if (isClosedUnderSMHK) + { + bearishScore += minScore; + } + if (isClosedUnderRawHK) + { + bearishScore += minScore; + } + if (isRawHKClosedUnderSMHK) + { + bearishScore += minScore; + } + if (isSMHKSwitchedToBearish) + { + bearishScore += highScore; + } + if (isRawHKSwitchedToBullish) + { + bearishScore += highScore; + } + + // + // + // } /** diff --git a/Indicators/x-saherelm.x121.xwz.mq5 b/Indicators/x-saherelm.x121.xwz.mq5 index 8fbdca72..8828b358 100644 --- a/Indicators/x-saherelm.x121.xwz.mq5 +++ b/Indicators/x-saherelm.x121.xwz.mq5 @@ -23,19 +23,11 @@ // Definitions ... // -enum ENUM_XWZ_REJECTION_TYPES -{ - XWZ_REJECTION_BAR, // Only Bar Reject - XWZ_REJECTION_STRONG_BAR, // Directional Bar Reject - XWZ_REJECTION_PRESSURED_BAR, // Bar Reject using Pressure - XWZ_REJECTION_STRONG_PRESSURED_BAR, // Strong Bar Reject using Pressure -}; - -// -#define ShortName "X121 XWZ" +#define ShortName "X121_XWZ" // // Includes Common Library ... +#include "../Classes/x-saherelm.x-alert.class.mq5" #include "../Classes/x-saherelm.x-bar.analyser.class.mq5" #include "../Classes/x-saherelm.x-poi.drawer.class.mq5" #include "../Libraries/x-saherelm.common.lib.mq5" @@ -59,14 +51,21 @@ input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method // input group "ATR StopLoss"; -input int atrLength = 14; // ATR Length -input int atrMultiplier = 2; // ATR Multiplier +input int atrLength = 14; // ATR Length +input double atrMultiplier = 2; // ATR Multiplier // input group "ADX Detection"; input int adxLength = 14; // ADX Length input double adxThreshold = 25; // ADX Threshold for Strong Trends +// +input group "Alert"; +input bool mXWZEnableAlerts = true; // Enable Alerts +input bool mXWZPushAlerts = false; // Push Alerts +input bool mXWZMailAlerts = false; // Mail Alerts +input bool mXWZTerminalAlerts = false; // Terminal Alerts + // // Presentation ... input group "Presentation"; @@ -85,7 +84,7 @@ input bool showRejection = true; // Show Rejection Bars // input group "POI Presentation"; -input bool showPOIs = true; // Show POI(s) +input bool showPOIs = false; // Show POI(s) input bool showActivatedPOIs = true; // Show Activated POI(s) input bool showOrderBlocks = true; // Show Order Blocks input bool showFairValueGaps = true; // Show Fair Value Gaps @@ -308,6 +307,7 @@ int atrHandler = INVALID_HANDLE; int adxHandler = INVALID_HANDLE; // +XCAlert *mXWZAlert; CArrayObj mXWZDrawnObjects; XCPOIDrawer *mXWZPOIDrawer; XCBarAnalyser *mXWZBarAnalyser; @@ -316,17 +316,21 @@ XCBarAnalyser *mXWZBarAnalyser; datetime lastBullishTrend = NULL; datetime lastBearishTrend = NULL; +// +datetime lastCrossedOverMA = NULL; +datetime lastCrossedUnderMA = NULL; + // // POI(s) ... // bool mXWZDetectOrderBlocks = true; -bool mXWZDetectFairValueGaps = true; -bool mXWZDetectSupportZones = true; -bool mXWZDetectResistanceZones = true; +bool mXWZDetectFairValueGaps = false; +bool mXWZDetectSupportZones = false; +bool mXWZDetectResistanceZones = false; // -bool filterPOIsUsingMa = true; // Filter POI(s) Using MA +bool filterPOIsUsingMa = false; // Filter POI(s) Using MA bool filterPOIsUsingZones = false; // Filter POI(s) Using Zones // @@ -436,6 +440,10 @@ int OnInit() mXWZPOIDrawer = new XCPOIDrawer(); ConfigurePOIDrawer(); + // + mXWZAlert = new XCAlert(); + ConfigureAlert(); + // mXWZBarAnalyser = new XCBarAnalyser(); @@ -472,6 +480,7 @@ void OnDeinit(const int reason) mXWZDrawnObjects.Clear(); // + ZeroMemory(mXWZAlert); ZeroMemory(mXWZPOIDrawer); ZeroMemory(mXWZBarAnalyser); @@ -1112,6 +1121,7 @@ void CalculateValues( pBar.Clean(); return; } + int pIndex = pBar.Index(); // // Calculate Applied Price ... @@ -1126,6 +1136,7 @@ void CalculateValues( // double iMa = maBuffer[bar_index]; + double iMaPrev = maBuffer[pIndex]; double iAtr = atrBuffer[bar_index]; double iAdx = adxBuffer[bar_index]; double iAppliedAtr = iAtr * atrMultiplier; @@ -1157,6 +1168,33 @@ void CalculateValues( bool hasLastResistance = lastResistance != NULL && lastResistance.IsValid(); + // + // Calculate Crossing Over / Under Ma ... + bool isCrossedOverMA = + // + iBar.low > iMa && + (pBar.low <= iMaPrev && + (pBar.GetUp() <= iMaPrev || + pBar.GetDown() <= iMaPrev)) + // + ; + bool isCrossedUnderMA = + // + iBar.high < iMa && + (pBar.high >= iMaPrev && + (pBar.GetUp() >= iMaPrev || + pBar.GetDown() >= iMaPrev)) + // + ; + lastCrossedOverMA = + isCrossedOverMA + ? iBar.time + : lastCrossedOverMA; + lastCrossedUnderMA = + isCrossedUnderMA + ? iBar.time + : lastCrossedUnderMA; + // // SL Buffers ... @@ -1594,7 +1632,7 @@ void CalculateValues( : iSwingLowValue < iMa ? iSwingLowValue : 0; - } + } // if (isSwingHigh) @@ -1629,6 +1667,22 @@ void CalculateValues( swingHighBuffer[bar_index] = iSwingHighValue; } + // + // + // + + // + DetectSignals( + bar_index, + prevCalculated, + ratesTotal, + open, + high, + close, + low, + tickVolume // + ); + // // Cleanup Resources ... @@ -1637,6 +1691,339 @@ void CalculateValues( pBar.Clean(); } +// +void ConfigureAlert() +{ + // + mXWZAlert.SetPrefix(ShortName); + + // + mXWZAlert.SetPushAlerts(mXWZPushAlerts); + mXWZAlert.SetMailAlerts(mXWZMailAlerts); + mXWZAlert.SetEnableAlerts(mXWZEnableAlerts); + mXWZAlert.SetTerminalAlerts(mXWZTerminalAlerts); +} + +// +void DetectSignals( + int barIndex, + const int prevCalculated, + const int ratesTotal, + const double &open[], + const double &high[], + const double &close[], + const double &low[], + const long &tickVolume[] // +) +{ + // + // Calculate Signals ... + + // + XOHCL bar; + XOHCL pBar; + XOHCL ppBar; + bool isInited = bar.Init( + _Symbol, + _Period, + barIndex // + ); + if (!isInited) + { + return; + } + + // + isInited = bar.GetPreviousBar(pBar); + if (!isInited) + { + return; + } + + // + isInited = pBar.GetPreviousBar(ppBar); + if (!isInited) + { + return; + } + + // + int pIDX = pBar.Index(); + int ppIDX = ppBar.Index(); + + // + // Reading Buffers ... + + // + double ma = maBuffer[barIndex]; + double maPrev = maBuffer[pIDX]; + double maPPrev = maBuffer[ppIDX]; + + // + // Pin Bar ... + bool isBullisPinned = bullishPinBuffer[pIDX] > 0; + bool isBearisPinned = bearishPinBuffer[pIDX] > 0; + + // + // Engulf Bar ... + bool isBullisEngulfed = bullishEngulfBuffer[pIDX] > 0; + bool isBearisEngulfed = bearishEngulfBuffer[pIDX] > 0; + + // + // Rejection Bar ... + bool isBullishRejected = bullishRejectionBuffer[pIDX] > 0; + bool isBearishRejected = bearishRejectionBuffer[pIDX] > 0; + + // + // Momentum Bar ... + bool isBullishMomentum = bullishMomentumBuffer[pIDX] > 0; + bool isBearishMomentum = bearishMomentumBuffer[pIDX] > 0; + + // + // Checking Pullback ... + ENUM_X_DIRECTION pullbackDir; + bool hasPullback = mXWZBarAnalyser.HasPullBack( + pullbackDir, + bar // + ); + bool hasBullishPullback = + hasPullback && + IsBullish(pullbackDir); + bool hasBearishPullback = + hasPullback && + IsBearish(pullbackDir); + + // + // Order Block Parsing ... + + // // + // bool isMACrossedOverBullishOB = + // // + // lastBullOB != NULL && + // lastBullOB.IsValid() && + // // + // IsInside( + // maPPrev, + // lastBullOB // + // ) && + // // + // IsAbove( + // maPrev, + // lastBullOB // + // ) + // // + // ; + + // // + // bool isMACrossedUnderBearishOB = + // // + // lastBearOB != NULL && + // lastBearOB.IsValid() && + // // + // IsInside( + // maPPrev, + // lastBearOB // + // ) && + // // + // IsBelow( + // maPrev, + // lastBearOB // + // ) + // // + // ; + + // + // Bullish ... + // -------------- + // -[] a Bullish Wave Which Crossed Over MA ... + // -[] Trend is Bullish ... + // -[] PullBack to MA ... + // -[] Has a Bllish Rejection ... + bool hasBullishSignal = + // + pBar.IsBullish() && + pBar.low < maPrev && + pBar.GetDown() >= maPrev && + // + bar.open >= ma && + // + hasBearishPullback && + // + false + // + ; + + // + // Bearish ... + // -------------- + // -[] a Bearish Wave Which Crossed Under MA ... + // -[] Trend is Bearish ... + // -[] PullBack to MA ... + // -[] Has a Bearish Rejection ... + bool hasBearishSignal = + // + false + // pBar.IsBearish() && + // pBar.high > maPrev && + // pBar.GetUp() <= maPrev && + // // + // bar.open <= ma && + // // + // true + // + ; + + // + // Draw ... + // + + // + long chartID = mXWZPOIDrawer.ChartIdentification(); + int window = mXWZPOIDrawer.SubWindowIdentification(); + + // // + // if (isMACrossedOverBullishOB) + // { + // // + // string name = + // "Bullish_" + + // ToMD5(ToFormatString(pBar.time)); + + // // + // CChartObjectVLine *iLine; + // iLine = new CChartObjectVLine(); + // bool isCreated = iLine.Create( + // chartID, + // name, + // window, + // pBar.time // + // ); + // if (isCreated) + // { + // // + // iLine.Color(clrAqua); + + // // + // mXWZDrawnObjects.Add(iLine); + // } + // } + + // // + // if (isMACrossedUnderBearishOB) + // { + // // + // string name = + // "Bearish_" + + // ToMD5(ToFormatString(pBar.time)); + + // // + // CChartObjectVLine *iLine; + // iLine = new CChartObjectVLine(); + // bool isCreated = iLine.Create( + // chartID, + // name, + // window, + // pBar.time // + // ); + // if (isCreated) + // { + // // + // iLine.Color(clrMagenta); + + // // + // mXWZDrawnObjects.Add(iLine); + // } + // } + + // + bool hasSignal = + (hasBullishSignal || + hasBearishSignal); + if (hasSignal) + { + // + long chartID = mXWZPOIDrawer.ChartIdentification(); + int window = mXWZPOIDrawer.SubWindowIdentification(); + string name = + (hasBullishSignal + ? "Bullish_" + : "Bearish_") + + "Signal_" + ToMD5(ToFormatString(bar.time)); + color signalColor = + hasBullishSignal + ? clrYellow + : clrOrange; + + // + CChartObjectVLine *iSignal; + iSignal = new CChartObjectVLine(); + bool isCreated = iSignal.Create( + chartID, + name, + window, + bar.time // + ); + if (isCreated) + { + // + iSignal.Color(signalColor); + + // + mXWZDrawnObjects.Add(iSignal); + } + + // + bool drawRR = false; + if (drawRR) + { + // + XRR iSigRR; + ENUM_X_POSITION_TYPES type = + hasBullishSignal + ? X_POSITION_TYPE_LONG + : X_POSITION_TYPE_SHORT; + double sl = hasBullishSignal + ? longSLBuffer[barIndex] + : shortSLBuffer[barIndex]; + + // + isCreated = iSigRR.Init( + _Symbol, + _Period, + sl, + bar.open, + type, + ShortName // + ); + if (!isCreated) + { + return; + } + + // + iSigRR.time = pBar.NextAt(); + + // + XCRRObject *iObj; + isCreated = mXWZPOIDrawer.CreateRR( + iSigRR, + iObj // + ); + if (isCreated) + { + mXWZDrawnObjects.Add(iObj); + } + + // + iSigRR.Clean(); + } + } + + // + bar.Clean(); + pBar.Clean(); +} + // // POIS Functions ... diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 index 8fa72127..cb7435b8 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 @@ -35,6 +35,7 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Props ... XOBFVG targetZone; + XOBFVG signalZone; XOBFVG waitingZone; X121SMCStrategyXWZWorkingZone workingZone; X121SMCStrategyXWZSignalConditions mConditions; @@ -342,6 +343,9 @@ class XCX121SMCXWZSignalDetector : public XCBase bool hasSupResBullishConditions = false; bool hasSupResBearishConditions = false; + // + ENUM_X121SMC_XWZ_PROVIDERS provider = X121SMC_XWZ_PROVIDER_NONE; + // // Detect Working Zone ... bool hasWorkingZone = workingZone.IsValid(); @@ -518,47 +522,57 @@ class XCX121SMCXWZSignalDetector : public XCBase ); hasOrderFlow = IsValidSize(orderFlowCount); } - result = hasOrderFlow; - if (!result) - { - // - Clean(visionPoiEvents); - Clean(analysePoiEvents); - Clean(decisionPoiEvents); - Clean(consolidationPoiEvents); + // + bool hasTrend = HasDirection(trend); + bool hasBllishTrend = + hasTrend && + IsBullish(trend); + bool hasBearishTrend = + hasTrend && + IsBearish(trend); - // - Clean(visionCycleEvents); - Clean(analyseCycleEvents); - Clean(decisionCycleEvents); - Clean(consolidationCycleEvents); + // result = hasOrderFlow; + // if (!result) + // { - // - visionState.Clean(); - analyseState.Clean(); - decisionState.Clean(); - consolidationState.Clean(); + // // + // Clean(visionPoiEvents); + // Clean(analysePoiEvents); + // Clean(decisionPoiEvents); + // Clean(consolidationPoiEvents); - // - visionConditions.Clean(); - analyseConditions.Clean(); - decisionConditions.Clean(); - consolidationConditions.Clean(); + // // + // Clean(visionCycleEvents); + // Clean(analyseCycleEvents); + // Clean(decisionCycleEvents); + // Clean(consolidationCycleEvents); - // - visionXConditions.Clean(); - analyseXConditions.Clean(); - decisionXConditions.Clean(); - consolidationXConditions.Clean(); + // // + // visionState.Clean(); + // analyseState.Clean(); + // decisionState.Clean(); + // consolidationState.Clean(); - // - mConditions.Clean(); - consolidationZBar.Clean(); + // // + // visionConditions.Clean(); + // analyseConditions.Clean(); + // decisionConditions.Clean(); + // consolidationConditions.Clean(); - // - return result; - } + // // + // visionXConditions.Clean(); + // analyseXConditions.Clean(); + // decisionXConditions.Clean(); + // consolidationXConditions.Clean(); + + // // + // mConditions.Clean(); + // consolidationZBar.Clean(); + + // // + // return result; + // } // // TODO: Remove this ... @@ -732,10 +746,59 @@ class XCX121SMCXWZSignalDetector : public XCBase isFVGActivated) { // - // TODO: Implement Order Flow Side Trading Senario ... youngestOrderFlow .UpdateZones(decisionState); - + + // + signalZone = youngestOrderFlow; + youngestOrderFlow.Clean(); + ArrayRemove( + workingZone.orderFlow, + youngestOBFVGIDX, + 1 // + ); + + // + provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE; + } + else + { + // + bool isPriceInsideFVG = + // + IsInside( + consolidationZBar.high, + youngestOrderFlow.fvg // + ) + // + && + // + IsInside( + consolidationZBar.low, + youngestOrderFlow.fvg // + ) + // + ; + + // + if (isPriceInsideFVG) + { + // + youngestOrderFlow + .UpdateZones(decisionState); + + // + signalZone = youngestOrderFlow; + youngestOrderFlow.Clean(); + ArrayRemove( + workingZone.orderFlow, + youngestOBFVGIDX, + 1 // + ); + + // + provider = X121SMC_XWZ_PROVIDER_PRICE_INSIDE_ZONE; + } } // @@ -1074,10 +1137,10 @@ class XCX121SMCXWZSignalDetector : public XCBase { // workingZone.AddOrderFlowItem(waitingZone); - mWorkingZoneObjects.Clear(); // // TODO: Remove this ... + mWorkingZoneObjects.Clear(); DrawWorkingZone( visionCycleHelper.mPOIDrawer // ); @@ -1097,25 +1160,112 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Reading Trand Line Value ... double zValue = workingZone.GetOrderFlowTrendLinePrice( - zIndex, + zIndex, period // ); double cValue = workingZone.GetOrderFlowTrendLinePrice( - cIndex, + cIndex, period // ); double pValue = workingZone.GetOrderFlowTrendLinePrice( - pIndex, + pIndex, period // ); double ppValue = workingZone.GetOrderFlowTrendLinePrice( - ppIndex, + ppIndex, period // ); // - // TODO: Implement Trend Line Trading Senario ... + // Implementing Signals ... + // + // + // TODO: Implement Order Flow Side Trading Senario ... + bool hasOrderFlowConditions = + hasTrend && + hasPriority && + hasRewardAmount && + signalZone.IsValid() && + provider == X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE; + + // + hasOrderFlowhBullishConditions = + isBullish && + hasOrderFlowConditions && + signalZone.IsBullish(); + + // + hasOrderFlowhBearishConditions = + isBearish && + hasOrderFlowConditions && + signalZone.IsBearish(); + + // + if (hasOrderFlowConditions) + { + // + mConditions.signalZone = signalZone; + mConditions.targetZone = targetZone; + + // + point = hasOrderFlowhBullishConditions + ? signalZone.ob.Upper() + : signalZone.ob.Lower(); + + // + pivot = hasOrderFlowhBullishConditions + ? signalZone.ob.Lower() + : signalZone.ob.Upper(); + + // + signalZone.Clean(); + } + + // + // TODO: Implement Inside Zone Trading Senario ... + bool hasInsideZoneConditions = + hasTrend && + hasPriority && + hasRewardAmount && + signalZone.IsValid() && + provider == X121SMC_XWZ_PROVIDER_PRICE_INSIDE_ZONE; + + // + bool hasInsideZoneBullishConditions = + isBullish && + signalZone.IsBullish() && + hasInsideZoneConditions; + + // + bool hasInsideZoneBearishConditions = + isBearish && + signalZone.IsBearish() && + hasInsideZoneConditions; + + // + if (hasInsideZoneConditions) + { + // + mConditions.signalZone = signalZone; + mConditions.targetZone = targetZone; + + // + point = hasOrderFlowhBullishConditions + ? signalZone.ob.Upper() + : signalZone.ob.Lower(); + + // + pivot = hasOrderFlowhBullishConditions + ? signalZone.ob.Lower() + : signalZone.ob.Upper(); + + // + signalZone.Clean(); + } + + // + // TODO: Implement Trend Line Trading Senario ... // // TODO: Implement Quarter Line Trading Senario ... @@ -1169,6 +1319,7 @@ class XCX121SMCXWZSignalDetector : public XCBase mConditions.target = target; mConditions.setupTime = cTime; mConditions.priority = priority; + mConditions.provider = provider; mConditions.amountPercent = amountPercent; } @@ -1206,7 +1357,7 @@ class XCX121SMCXWZSignalDetector : public XCBase consolidationXConditions.Clean(); // - mConditions.Clean(); + // mConditions.Clean(); consolidationZBar.Clean(); // @@ -1272,39 +1423,6 @@ class XCX121SMCXWZSignalDetector : public XCBase // int loopback = 10; - // - XOHCL zBar; - result = decisionCycleHelper.GetBar( - zBar, - zIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL cBar; - result = decisionCycleHelper.GetBar( - cBar, - cIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL pBar; - result = decisionCycleHelper.GetBar( - pBar, - pIndex // - ); - if (!result) - { - return result; - } - // double ask = GetAsk(symbol); double bid = GetBid(symbol); @@ -1312,11 +1430,7 @@ class XCX121SMCXWZSignalDetector : public XCBase double points = GetPoints(symbol); // - int swingLoopback = 9; - double ll = cBar.FindLowest(swingLoopback, MODE_LOW); - double hh = cBar.FindHighest(swingLoopback, MODE_HIGH); - double llDown = cBar.FindLowesttDown(swingLoopback); - double hhUp = cBar.FindHighestUp(swingLoopback); + double sls[]; // // Cycles Conditions ... @@ -1337,9 +1451,6 @@ class XCX121SMCXWZSignalDetector : public XCBase { // // Cleanup ... - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); // Clean(decisionPoiEvents); @@ -1360,16 +1471,357 @@ class XCX121SMCXWZSignalDetector : public XCBase // Cycle X121Conditions ... X121Conditions decisionXConditions = decisionConditions.x121Conditions; + // + // Check Signal Validation ... + + // + XOHCL cBar; + bool isInited = cBar.Init( + conditions.symbol, + conditions.period, + cIndex // + ); + XOHCL pBar; + isInited = + isInited && + cBar.GetPreviousBar(pBar); + bool isLowerBreaked = + // + isInited && + cBar.high < conditions.point && + pBar.high >= conditions.point + // + ; + bool isUpperBreaked = + // + isInited && + cBar.low > conditions.point && + pBar.low <= conditions.point + // + ; + bool isZoneBreaked = + (isBullish && + isLowerBreaked) || + (isBearish && + isUpperBreaked); + result = !isZoneBreaked; + if (!result) + { + // + cBar.Clean(); + pBar.Clean(); + conditions.Clean(); + + // + Clean(decisionPoiEvents); + Clean(decisionCycleEvents); + + // + decisionState.Clean(); + decisionConditions.Clean(); + decisionXConditions.Clean(); + } + + // + cBar.Clean(); + pBar.Clean(); + + // + double bullishScore = 0; + double bearishScore = 0; + decisionXConditions.GenerateScore( + bullishScore, + bearishScore // + ); + + // + // Base SL Used Pivot of Conditions ... + Add( + conditions.pivot, + sls // + ); + + // + int lowestSupportIDX = -1; + int highestResistanceIDX = -1; + bool isSupportRejected = false; + bool isResistanceRejected = false; + bool hasSignalZone = conditions.signalZone.IsValid(); + if (hasSignalZone) + { + // + conditions + .signalZone + .UpdateZones(decisionState); + conditions + .signalZone + .UpdateTo(cTime); + + // + XOHCL cBar; + bool isBarInited = cBar.Init( + conditions.symbol, + conditions.period, + cIndex // + ); + + // + lowestSupportIDX = GetLowest(conditions.signalZone.supportZones); + if (IsValidIndex(lowestSupportIDX)) + { + // + isSupportRejected = + // + isBarInited && + ( + // + (cBar.low < conditions.signalZone.supportZones[lowestSupportIDX].Upper() && + cBar.GetDown() > conditions.signalZone.supportZones[lowestSupportIDX].Upper()) + // + || + // + (cBar.low < conditions.signalZone.supportZones[lowestSupportIDX].Lower() && + cBar.GetDown() > conditions.signalZone.supportZones[lowestSupportIDX].Lower()) + // + ) + // + ; + + // + if (isBullish) + { + // + double vPivot = conditions.signalZone.supportZones[lowestSupportIDX].Lower(); + bool canSetPivot = conditions.pivot < vPivot; + if (canSetPivot) + { + // + Add( + vPivot, + sls // + ); + } + } + } + + // + highestResistanceIDX = GetHighest(conditions.signalZone.resistanceZones); + if (IsValidIndex(highestResistanceIDX)) + { + // + isSupportRejected = + // + isBarInited && + ( + // + (cBar.high > conditions.signalZone.resistanceZones[highestResistanceIDX].Upper() && + cBar.GetUp() < conditions.signalZone.resistanceZones[highestResistanceIDX].Upper()) + // + || + // + (cBar.high > conditions.signalZone.resistanceZones[highestResistanceIDX].Lower() && + cBar.GetUp() < conditions.signalZone.resistanceZones[highestResistanceIDX].Lower()) + // + ) + // + ; + + // + if (isBearish) + { + // + double vPivot = conditions.signalZone.resistanceZones[highestResistanceIDX].Upper(); + bool canSetPivot = conditions.pivot > vPivot; + if (canSetPivot) + { + // + Add( + vPivot, + sls // + ); + } + } + } + + // + cBar.Clean(); + } + + // + // Consolidation Zone Detection ... + + // + // Bullish Consolidation Zone ... + XConsolidationZone lastBullishConsolidationZone; + bool hasBullishConsolidationZone = decisionCycleHelper + .GetLastDirectionalConsolidationZone( + X_DIRECTION_BULLISH, + lastBullishConsolidationZone // + ); + if (hasBullishConsolidationZone) + { + // + // Validate Consolidation Zone ... + hasBullishConsolidationZone = + lastBullishConsolidationZone.lower > conditions.pivot; + + // + if (isBullish && + hasBullishConsolidationZone) + { + // + double vPivot = lastBullishConsolidationZone.lower; + bool canSetPivot = conditions.pivot < vPivot; + if (canSetPivot) + { + // + Add( + vPivot, + sls // + ); + } + } + } + lastBullishConsolidationZone.Clean(); + + // + // Bearish Consolidation Zone ... + XConsolidationZone lastBearishConsolidationZone; + bool hasBearishConsolidationZone = decisionCycleHelper + .GetLastDirectionalConsolidationZone( + X_DIRECTION_BEARISH, + lastBearishConsolidationZone // + ); + if (hasBearishConsolidationZone) + { + // + // Validate Consolidation Zone ... + hasBearishConsolidationZone = + lastBearishConsolidationZone.upper < conditions.pivot; + + // + if (isBearish && + hasBearishConsolidationZone) + { + // + double vPivot = lastBearishConsolidationZone.upper; + bool canSetPivot = conditions.pivot > vPivot; + if (canSetPivot) + { + // + Add( + vPivot, + sls // + ); + } + } + } + lastBearishConsolidationZone.Clean(); + + // + // Check VWap Crossing ... + + // + bool isVWapSwitchedToBullish = + // + (decisionXConditions.isVWapBullishOrdered && + decisionXConditions.isVWapSwitchedToBullishState) + // + || + // + (decisionXConditions.isVWapBullishState && + decisionXConditions.isVWapSwitchedToBullishOrdered) + // + ; + if (isBullish && + isVWapSwitchedToBullish) + { + // + double vPivot = decisionXConditions.vwapMin; + bool canSetPivot = conditions.pivot < vPivot; + if (canSetPivot) + { + // + Add( + vPivot, + sls // + ); + } + } + + // + bool isVWapSwitchedToBearish = + // + (decisionXConditions.isVWapBearishOrdered && + decisionXConditions.isVWapSwitchedToBearishState) + // + || + // + (decisionXConditions.isVWapBearishState && + decisionXConditions.isVWapSwitchedToBearishOrdered) + // + ; + if (isBearish && + isVWapSwitchedToBearish) + { + // + double vPivot = decisionXConditions.vwapMax; + bool canSetPivot = conditions.pivot > vPivot; + if (canSetPivot) + { + // + Add( + vPivot, + sls // + ); + } + } + + // + // Point Break ... + isInited = cBar.Init( + conditions.symbol, + conditions.period, + cIndex // + ); + double point = conditions.point; + bool isPointBreaked = + isInited && + IsBarBreak( + point, + setupDir, + cBar // + ); + cBar.Clean(); + // // Trigger Conditions ... // - double point = conditions.point; - bool isPointBreaked = IsBarBreak( - point, - setupDir, - cBar // - ); + bool canTriggerActivatedZone = + // + // isPointBreaked && + (isSupportRejected || + hasBullishConsolidationZone) && + bullishScore > (bearishScore * 1.5) && + conditions.provider == X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE + // + ; + + // + bool canTriggerPriceInsideZone = + // + // isPointBreaked && + (isResistanceRejected || + hasBearishConsolidationZone) && + bearishScore > (bullishScore * 1.5) && + conditions.provider == X121SMC_XWZ_PROVIDER_PRICE_INSIDE_ZONE + // + ; + + // + bool canTrigger = (canTriggerActivatedZone || + canTriggerPriceInsideZone); // // Summary ... @@ -1377,20 +1829,16 @@ class XCX121SMCXWZSignalDetector : public XCBase // isBullish = // - isBullish - // && - // isPointBreaked && - // cBar.IsBullish() + isBullish && + canTrigger // ; // isBearish = // - isBearish - // && - // isPointBreaked && - // cBar.IsBearish() + isBearish && + canTrigger // ; @@ -1411,9 +1859,6 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Cleanup ... - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); // Clean(decisionPoiEvents); @@ -1428,9 +1873,6 @@ class XCX121SMCXWZSignalDetector : public XCBase return result; } - // - // Detect Nearest Pivot Point ... - // double entry = GetEntry( conditions.symbol, @@ -1440,19 +1882,12 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Manipulate SL Based on Consolidation Zones ... - // - double sls[]; - Add( - conditions.pivot, - sls // - ); - // // TODO: Add Consolidation Zone for SLs ... // double iAtr = decisionXConditions.atrBuffer[1]; - iAtr *= 2; + iAtr *= 0; // double slsMin = GetMin(sls); @@ -1460,8 +1895,8 @@ class XCX121SMCXWZSignalDetector : public XCBase // double sl = isBullish - ? slsMin - iAtr - : slsMax + iAtr; + ? slsMax - iAtr + : slsMin + iAtr; double risk = MathAbs(entry - sl); // @@ -1474,9 +1909,6 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Cleanup ... - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); // Clean(decisionPoiEvents); @@ -1507,7 +1939,6 @@ class XCX121SMCXWZSignalDetector : public XCBase { // bool result = false; - return result; // Clean(guards); @@ -1891,128 +2322,22 @@ class XCX121SMCXWZSignalDetector : public XCBase // Detect Consolidation Zone ... // - XBoxZone lastBullishBox; - XBoxZone prevLastBullishBox; - bool hasLastBullishBox = false; - bool hasPrevLastBullishBox = false; - XConsolidationZone lastBullishZone; - bool isLastBullishAbovePrev = false; - bool isLastBullishBelowPrev = false; - XConsolidationZone prevLastBullishZone; + // Bullish ... + XConsolidationZone bullishConsolidationZone; + bool hasBullishConsolidationZone = decisionCycleHelper + .GetLastDirectionalConsolidationZone( + X_DIRECTION_BULLISH, + bullishConsolidationZone // + ); // - XBoxZone lastBearishBox; - XBoxZone prevLastBearishBox; - bool hasLastBearishBox = false; - bool hasPrevLastBearishBox = false; - XConsolidationZone lastBearishZone; - bool isLastBearishAbovePrev = false; - bool isLastBearishBelowPrev = false; - XConsolidationZone prevLastBearishZone; - - // - int bullishConsolidationZonesCount = 0; - int bearishConsolidationZonesCount = 0; - bool hasBullishConsolidationZones = false; - bool hasBearishConsolidationZones = false; - XConsolidationZone bullishConsolidationZones[]; - XConsolidationZone bearishConsolidationZones[]; - bool hasConsolidationZones = decisionCycleHelper.HasConsolidationZones(); - int consolidationZonesCount = decisionCycleHelper.CountConsolidationZones(); - if (hasConsolidationZones) - { - // - bullishConsolidationZonesCount = decisionCycleHelper - .FillConsolidationZones( - X_DIRECTION_BULLISH, - bullishConsolidationZones // - ); - hasBullishConsolidationZones = IsValidSize(bullishConsolidationZonesCount); - - // - bearishConsolidationZonesCount = decisionCycleHelper - .FillConsolidationZones( - X_DIRECTION_BEARISH, - bearishConsolidationZones // - ); - hasBearishConsolidationZones = IsValidSize(bearishConsolidationZonesCount); - - // - // - // - - // - if (hasBullishConsolidationZones && - bullishConsolidationZonesCount >= 2) - { - // - lastBullishZone = bullishConsolidationZones[bullishConsolidationZonesCount - 1]; - prevLastBullishZone = bullishConsolidationZones[bullishConsolidationZonesCount - 2]; - - // - hasLastBullishBox = ToBox( - lastBullishBox, - lastBullishZone // - ); - hasPrevLastBullishBox = ToBox( - prevLastBullishBox, - prevLastBullishZone // - ); - - // - isLastBullishAbovePrev = hasLastBullishBox && - hasPrevLastBullishBox && - IsBoxAbove( - lastBullishBox, - prevLastBullishBox // - ); - - // - isLastBullishBelowPrev = hasLastBullishBox && - hasPrevLastBullishBox && - IsBoxBelow( - lastBullishBox, - prevLastBullishBox // - ); - } - - // - if (hasBearishConsolidationZones && - bearishConsolidationZonesCount >= 2) - { - // - lastBearishZone = bearishConsolidationZones[bearishConsolidationZonesCount - 1]; - prevLastBearishZone = bearishConsolidationZones[bearishConsolidationZonesCount - 2]; - - // - hasLastBearishBox = ToBox( - lastBearishBox, - lastBearishZone // - ); - hasPrevLastBearishBox = ToBox( - prevLastBearishBox, - prevLastBearishZone // - ); - - // - isLastBearishAbovePrev = hasLastBearishBox && - hasPrevLastBearishBox && - IsBoxAbove( - lastBearishBox, - prevLastBearishBox // - ); - - // - isLastBearishBelowPrev = hasLastBearishBox && - hasPrevLastBearishBox && - IsBoxBelow( - lastBearishBox, - prevLastBearishBox // - ); - } - - // - } + // Bearish ... + XConsolidationZone bearishConsolidationZone; + bool hasBearishConsolidationZone = decisionCycleHelper + .GetLastDirectionalConsolidationZone( + X_DIRECTION_BEARISH, + bearishConsolidationZone // + ); // // Detect High Probability Swings ... @@ -2039,18 +2364,6 @@ class XCX121SMCXWZSignalDetector : public XCBase pBar.IsBearish() && pBar.GetHighShadow() >= pBar.GetBody() * 2; - // - bool isStrongSwingLowAboveLastBullishBox = - isStrongSwingLow && - hasLastBullishBox && - pBar.low > lastBullishBox.upper; - - // - bool isStrongSwingHighBelowLastBearishBox = - isStrongSwingHigh && - hasLastBearishBox && - pBar.high < lastBearishBox.lower; - // // Here We Have all Requirements for Guarding Positions ... @@ -2089,6 +2402,128 @@ class XCX121SMCXWZSignalDetector : public XCBase // // X_121_SMC_GUARD_ACTION_TRAIL_STOP: // Trail Stop Specified Position on Specified Conditions ... + for (int i = 0; i < count; i++) + { + // + XPosition iPosition = ownPositions[i]; + + // + bool isLong = IsLong(iPosition.type); + bool isInProfit = iPosition.profit > 0; + + // + double sl = iPosition.sl; + double tp = iPosition.tp; + + // + // Trail Stops Using Consolidation Zones ... + bool canTraiLonglUsingCZone = + // + (isLong && + isInProfit && + hasBullishConsolidationZone && + bullishConsolidationZone.lower > iPosition.sl && + bullishConsolidationZone.lower > iPosition.entry) + // + ; + if (canTraiLonglUsingCZone) + { + sl = bullishConsolidationZone.lower; + } + + // + bool canTraiShortlUsingCZone = + // + (!isLong && + isInProfit && + hasBearishConsolidationZone && + bearishConsolidationZone.upper < iPosition.sl && + bearishConsolidationZone.upper < iPosition.entry) + // + ; + if (canTraiShortlUsingCZone) + { + sl = bearishConsolidationZone.upper; + } + + // + bool canTrailUsingCZone = + canTraiLonglUsingCZone || + canTraiShortlUsingCZone; + + // + // Trail Stops Using Swings ... + + // + bool canTrailLongUsingSwings = + // + isLong && + isInProfit && + (isSwingLow || + isStrongSwingLow) && + pBar.low > iPosition.sl && + pBar.low > iPosition.entry + // + ; + if (canTrailLongUsingSwings) + { + sl = pBar.low; + } + + // + bool canTraiShortlUsingSwings = + // + !isLong && + isInProfit && + (isSwingHigh || + isStrongSwingHigh) && + pBar.high < iPosition.sl && + pBar.high < iPosition.entry + // + ; + if (canTraiShortlUsingSwings) + { + sl = pBar.high; + } + + // + bool canTrailUsingSwings = + canTrailLongUsingSwings || + canTraiShortlUsingSwings; + + // + // + // + + // + bool canTrail = + sl != iPosition.sl && + (canTrailUsingCZone || + canTrailUsingSwings); + if (canTrail) + { + // + X121SMCGuard iGuard; + + // + iGuard.time = cTime; + iGuard.symbol = symbol; + iGuard.provider = provider; + iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_STOP; + + // + iGuard.ticket = iPosition.ticket; + + // + iGuard.sl = sl; + + // + AddGuard( + iGuard, + guards // + ); + } + } // // X_121_SMC_GUARD_ACTION_TRAIL_TARGET: @@ -2136,16 +2571,6 @@ class XCX121SMCXWZSignalDetector : public XCBase consolidationConditions.Clean(); consolidationXConditions.Clean(); - // - lastBullishBox.Clean(); - lastBearishBox.Clean(); - lastBullishZone.Clean(); - lastBearishZone.Clean(); - prevLastBullishBox.Clean(); - prevLastBearishBox.Clean(); - prevLastBullishZone.Clean(); - prevLastBearishZone.Clean(); - // count = ArraySize(guards); result = IsValidSize(count); @@ -2839,6 +3264,8 @@ class XCX121SMCXWZSignalDetector : public XCBase void DeInit() { // + signalZone.Clean(); + targetZone.Clean(); mConditions.Clean(); workingZone.Clean(); Clean(mConditionsCollection); diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 index 5d408c3a..94e8a76e 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 @@ -26,6 +26,14 @@ #include "../Libraries/x-121.smc.guard.lib.mq5" #include "../Libraries/x-121.smc.lib.mq5" +// +enum ENUM_X121SMC_XWZ_PROVIDERS +{ + X121SMC_XWZ_PROVIDER_NONE, + X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE, + X121SMC_XWZ_PROVIDER_PRICE_INSIDE_ZONE, +}; + // enum ENUM_X121SMC_XWZ_PRIORITY { @@ -1143,8 +1151,13 @@ struct X121SMCStrategyXWZSignalConditions double pivot; double point; + // + XOBFVG targetZone; + XOBFVG signalZone; + // ENUM_X121SMC_XWZ_PRIORITY priority; + ENUM_X121SMC_XWZ_PROVIDERS provider; // // Constructor ... @@ -1271,6 +1284,13 @@ struct X121SMCStrategyXWZSignalConditions target = 0; reward = 0; amountPercent = 0; + + // + targetZone.Clean(); + signalZone.Clean(); + + // + provider = X121SMC_XWZ_PROVIDER_NONE; } // diff --git a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 index 61a05b35..f5b1a70d 100644 --- a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 +++ b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 @@ -887,9 +887,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // // XVWAP ... - x121Inputs.xvwapInputs.showVWapFast = showAll || false; - x121Inputs.xvwapInputs.showVWapMedium = showAll || false; - x121Inputs.xvwapInputs.showVWapSlow = showAll || false; + x121Inputs.xvwapInputs.showVWapFast = showAll || true; + x121Inputs.xvwapInputs.showVWapMedium = showAll || true; + x121Inputs.xvwapInputs.showVWapSlow = showAll || true; // // Initialize Cycle Helpers ...