diff --git a/Classes/x-saherelm.x-poi.drawer.class.mq5 b/Classes/x-saherelm.x-poi.drawer.class.mq5 index 4d304820..f04f6852 100644 --- a/Classes/x-saherelm.x-poi.drawer.class.mq5 +++ b/Classes/x-saherelm.x-poi.drawer.class.mq5 @@ -2902,6 +2902,11 @@ class XCPOIDrawer : public XCBase long chartID = ChartIdentification(); int window = SubWindowIdentification(); + // + color czColor = IsBullish(zone.breakDir) + ? BarBullishColor() + : BarBearishColor(); + // object = new XCConsolidationZoneObject(); result = object.Create( @@ -2911,6 +2916,12 @@ class XCPOIDrawer : public XCBase prefix // ); + // + if (result) + { + object.ZoneColor(czColor); + } + // return result; } diff --git a/Libraries/x-saherelm.x-poi.lib.mq5 b/Libraries/x-saherelm.x-poi.lib.mq5 index e9e265f3..46e1a63e 100644 --- a/Libraries/x-saherelm.x-poi.lib.mq5 +++ b/Libraries/x-saherelm.x-poi.lib.mq5 @@ -68,8 +68,9 @@ enum ENUM_XPOIS X_POI_BEARISH_ORDERBLOCK, // Bearish Order Block ... // // Fair Value Gaps ... - X_POI_BULLISH_FVG, // Bullish Order Block ... - X_POI_BEARISH_FVG, // Bearish Order Block ... + X_POI_BULLISH_FVG, // Bullish Order Block ... + X_POI_BEARISH_FVG, // Bearish Order Block ... + X_POI_CONSOLIDATION_ZONE, // Consolidation Zone ... }; // @@ -5557,8 +5558,8 @@ struct XConsolidationZone int loopback; // Loopback ... // - ENUM_X_DIRECTION breakDirection; // Break Direction ... - XOHCL breakerBar; // Breaker Bar ... + ENUM_X_DIRECTION breakDir; // Break Direction ... + XOHCL breakerBar; // Breaker Bar ... // // Constructor ... @@ -5712,11 +5713,11 @@ struct XConsolidationZone // // Calculate Break Direction ... breakerBar = cBar; - breakDirection = isBreakTop - ? X_DIRECTION_BULLISH - : isBreakBottom - ? X_DIRECTION_BEARISH - : X_DIRECTION_NONE; + breakDir = isBreakTop + ? X_DIRECTION_BULLISH + : isBreakBottom + ? X_DIRECTION_BEARISH + : X_DIRECTION_NONE; } /** @@ -5732,7 +5733,7 @@ struct XConsolidationZone period = NULL; initTime = NULL; breakerBar.Clean(); - breakDirection = X_DIRECTION_NONE; + breakDir = X_DIRECTION_NONE; // ZeroMemory(this); @@ -5775,7 +5776,7 @@ struct XConsolidationZone // result = breakerBar.IsValid() && - HasDirection(breakDirection); + HasDirection(breakDir); // return result; @@ -5795,7 +5796,7 @@ struct XConsolidationZone // result = IsBreaked() && - breakDirection == X_DIRECTION_BEARISH; + breakDir == X_DIRECTION_BEARISH; if (!result) { return result; @@ -5854,7 +5855,7 @@ struct XConsolidationZone // result = IsBreaked() && - breakDirection == X_DIRECTION_BULLISH; + breakDir == X_DIRECTION_BULLISH; if (!result) { return result; @@ -8665,12 +8666,12 @@ int FilterZones( bool isPricePassed = // isInside = - ignoreOutOfBox - ? isInside - : isInside && - (isIBullish - ? isAbove - : isBelow) + ignoreOutOfBox + ? isInside + : isInside && + (isIBullish + ? isAbove + : isBelow) // ; if (!isPricePassed) 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 a4b535d1..7ae0786c 100644 --- a/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 +++ b/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 @@ -430,6 +430,95 @@ class XC121SMCCycleHelper : public XCBase // // Consolidation Zones Implement here ... + // + int czLoopback = 5; + int maxAllowed = 20; + bool isActiveConsolidationZoneBreaked = false; + bool hasActiveConsolidationZone = mActiveConsolidationZone.IsValid(); + if (hasActiveConsolidationZone) + { + // + isActiveConsolidationZoneBreaked = mActiveConsolidationZone.IsBreaked(); + + // + if (isActiveConsolidationZoneBreaked) + { + // + AddRef( + mActiveConsolidationZone, + mConsolidationZones // + ); + + // + Add( + CONSOLIDATION_BREAKED_DETECTED, + events // + ); + + // + CleanupArray( + mConsolidationZones, + maxAllowed // + ); + + // // + // XCConsolidationZoneObject *czObj; + // bool isCreated = mPOIDrawer.CreateConsolidationZone( + // mActiveConsolidationZone, + // czObj // + // ); + // if (isCreated) + // { + // mConsolidationObjects.Add(czObj); + // } + + // + mActiveConsolidationZone.Clean(); + } + else + { + mActiveConsolidationZone.Update(); + } + } + else + { + // + XOHCL mBar; + bool hasBar = GetBar( + mBar, + 0 // + ); + if (hasBar) + { + // + double upper = 0; + double lower = 0; + bool hasConsolidationZone = + mBarAnalyser.IsConsolidate( + mBar, + upper, + lower, + czLoopback // + ); + + // + if (hasConsolidationZone) + { + // + mActiveConsolidationZone.Init( + GetSymbol(), + GetPeriod(), + upper, + lower, + loopback // + ); + } + } + + // + mBar.Clean(); + } + // result = conditions.IsValid(); @@ -461,6 +550,11 @@ class XC121SMCCycleHelper : public XCBase string mSymbol; ENUM_TIMEFRAMES mPeriod; + // + CArrayObj mConsolidationObjects; + XConsolidationZone mActiveConsolidationZone; + XConsolidationZone mConsolidationZones[]; + // // Actions ... @@ -478,6 +572,10 @@ class XC121SMCCycleHelper : public XCBase delete mX121Helper; delete mPOIDetector; delete mBarAnalyser; + + // + Clean(mConsolidationZones); + mActiveConsolidationZone.Clean(); } /** diff --git a/X121SMCEA/Libraries/x-121.smc.guard.lib.mq5 b/X121SMCEA/Libraries/x-121.smc.guard.lib.mq5 index c1f0e469..b87a824d 100644 --- a/X121SMCEA/Libraries/x-121.smc.guard.lib.mq5 +++ b/X121SMCEA/Libraries/x-121.smc.guard.lib.mq5 @@ -400,10 +400,10 @@ bool DetectX121SMCGuards( isConsolidationZoneBreaked = x121SMCConsolidationZone.IsBreaked(); isConsolidationZoneBreakedUp = isConsolidationZoneBreaked && - IsBullish(x121SMCConsolidationZone.breakDirection); + IsBullish(x121SMCConsolidationZone.breakDir); isConsolidationZoneBreakedDown = isConsolidationZoneBreaked && - IsBearish(x121SMCConsolidationZone.breakDirection); + IsBearish(x121SMCConsolidationZone.breakDir); // // consolidationZoneUpper = triggerXConditions.peaksBuffer[1];