diff --git a/Classes/x-saherelm.x-market.pattern.class.mq5 b/Classes/x-saherelm.x-market.pattern.class.mq5 index 826d1c5b..84fba2c6 100644 --- a/Classes/x-saherelm.x-market.pattern.class.mq5 +++ b/Classes/x-saherelm.x-market.pattern.class.mq5 @@ -227,6 +227,41 @@ class XCMarketPatternDetector : public XCBase return result; } + bool HasSameBars( + XOHCL &bar, + ENUM_X_DIRECTION &dir, + int &count, + int validation = 3 // + ) + { + // + bool result = false; + + // + // Normalize ... + count = 0; + dir = X_DIRECTION_NONE; + + // + // Validate ... + result = + bar.IsValid() && + validation > 1; + if (!result) + { + return result; + } + + // + result = + count > 0 && + HasDirection(dir) && + count >= validation; + + // + return result; + } + // // Detectors ... diff --git a/X121XKIEA/Classes/x-saherelm.x121.xki.x-poi.detector.class.mq5 b/X121XKIEA/Classes/x-saherelm.x121.xki.x-poi.detector.class.mq5 index 34c9da77..a46d475c 100644 --- a/X121XKIEA/Classes/x-saherelm.x121.xki.x-poi.detector.class.mq5 +++ b/X121XKIEA/Classes/x-saherelm.x121.xki.x-poi.detector.class.mq5 @@ -84,6 +84,7 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector string forSymbol = NULL, ENUM_TIMEFRAMES forPeriod = NULL, int loopback = 50, + int minAllowedSameDirectionalBars = 4, int confluence = 1, int confluenceLoopback = 50 // ) @@ -133,6 +134,41 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector confluenceLoopback = 0; } + // + if (minAllowedSameDirectionalBars < 0) + { + minAllowedSameDirectionalBars = 2; + } + + // + // Here We have to Detect Zones ... + // Preparing Loops ... + XOHCL tmpBar; + bool has = false; + double upper = 0; + double lower = 0; + XBoxZone tmpZone; + string type = NULL; + double tmpValue = 0; + datetime from = NULL; + int start = barIndex; + int end = barIndex + loopback; + datetime to = GetBarTime(forSymbol, forPeriod, barIndex); + for (int i = start; i < end; i++) + { + // + // Initialize Bar ... + has = tmpBar.Init(forSymbol, forPeriod, i); + if (has) + { + // + // Next Step is Detect Sequence Same Directional Bars ... + + // + tmpBar.Clean(); + } + } + // result = ArraySize(zones);