diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 index 265ce517..c5c62539 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 @@ -400,11 +400,11 @@ class XCX121SMCXWZSignalDetector : public XCBase hasWaitingZones = workingZone.DetectZone( drawer, analysePoiEvents, - consolidationPoiEvents, - consolidationPoiEvents, - consolidationState, + decisionPoiEvents, + analysePoiEvents, analyseState, - consolidationState // + decisionState, + analyseState // ); // @@ -468,8 +468,9 @@ class XCX121SMCXWZSignalDetector : public XCBase // Detect Signal Box ... hasSignalBox = hasWorkingZone && hasWaitingZones && - workingZone.IsZoneRejected( + workingZone.IsZoneOBRejected( activatedZone, + decisionXConditions, zIndex // ); if (hasSignalBox) @@ -484,27 +485,27 @@ class XCX121SMCXWZSignalDetector : public XCBase signalBoxDir = signalBox.dir; provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE; - // // - // int idx = FindIndex( - // activatedZone, - // workingZone.waitingZones // - // ); - // bool has = IsValidIndex(idx); - // if (has) - // { - // // - // ArrayRemove( - // workingZone.waitingZones, - // idx, - // 1 // - // ); + // + int idx = FindIndex( + activatedZone, + workingZone.waitingZones // + ); + bool has = IsValidIndex(idx); + if (has) + { + // + ArrayRemove( + workingZone.waitingZones, + idx, + 1 // + ); - // // - // AddRef( - // activatedZone, - // workingZone.unavailableZones // - // ); - // } + // + AddRef( + activatedZone, + workingZone.unavailableZones // + ); + } } } @@ -914,8 +915,7 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Summarize Results ... - result = false && - hasPriority && + result = hasPriority && hasSignalBox && hasRewardAmount; @@ -962,10 +962,12 @@ class XCX121SMCXWZSignalDetector : public XCBase true // Draw Waiting Zones Box Area ... // ); - + // - if (hasSignalBox) { - Print("Has Signal Box ..."); + if (hasSignalBox) + { + // + Print("Has Signal Box ..."); } } diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 index 17222468..0925ac87 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 @@ -728,6 +728,99 @@ struct X121SMCStrategyXWZWorkingZone return result; } + // + bool IsZoneOBRejected( + XOBFVG &zone, + X121Conditions &conditions, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + // Cleanup Result ... + zone.Clean(); + + // + // Normalize Bar Index ... + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (barIndex == 0) + { + barIndex = 1; + } + + // + XOHCL bar; + bool isInited = bar.Init( + symbol, + period, + barIndex // + ); + + // + // Validate ... + result = isInited && + IsValid() && + HasWaitingZones(); + if (!result) + { + return result; + } + + // + double points = GetPoints(bar.symbol); + + // + // Detecting Rejected Waiting Zone ... + int count = CountWaitingZones(); + for (int i = 0; i < count; i++) + { + // + // Detecting XBoxZone Area of Waiting Zone ... + XBoxZone iBox; + bool hasBox = waitingZones[i] + .ToZone(iBox); + if (hasBox) + { + // + double peak = conditions.peaksBuffer[1]; + double lower = waitingZones[i].ob.Lower(); + + // + double delta = MathAbs(lower - peak); + + // + result = delta == 0 || + delta < points * 2; + } + + // + // Validate Result ... + if (result) + { + // + iBox.Clean(); + zone = waitingZones[i]; + break; + } + + // + iBox.Clean(); + } + + // + bar.Clean(); + + // + return result; + } + // bool IsExists(XOBFVG &zone) {