From ddf021f4d4429ca2af59a4df629f642d7ab824af Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sat, 22 Mar 2025 15:32:23 +0330 Subject: [PATCH] last ... --- .../x-121.smc.x-tradehandler.class.mq5 | 7 +- .../Signals/x-121.smc.xwz.signal.lib.mq5 | 108 ++++++++++++++++++ 2 files changed, 113 insertions(+), 2 deletions(-) diff --git a/X121SMCEA/Classes/x-121.smc.x-tradehandler.class.mq5 b/X121SMCEA/Classes/x-121.smc.x-tradehandler.class.mq5 index cae1bce8..ce4d65bb 100644 --- a/X121SMCEA/Classes/x-121.smc.x-tradehandler.class.mq5 +++ b/X121SMCEA/Classes/x-121.smc.x-tradehandler.class.mq5 @@ -3471,6 +3471,9 @@ class XC121SMCTradeHandler : public XCBaseAlert // string prefix = "Protector: "; + // + int targetDistance = 5; + // // Implement Protection Senario Here ... int count = Count(); @@ -3758,8 +3761,8 @@ class XC121SMCTradeHandler : public XCBaseAlert // double targetDelta = isLong - ? target + (15 * points) - : target - (15 * points); + ? target + (targetDistance * points) + : target - (targetDistance * points); bool canRF = target > 0 && (isLong ? target > entry diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 index c57b3d80..3a93df99 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 @@ -776,6 +776,114 @@ struct X121SMCStrategyXWZWorkingZone } } + // + // Checking Other Senario for Waiting Boxes ... + if (obStateEvents.hasNewSharp) + { + // + XBoxZone currSharp; + XBoxZone prevSharp; + + // + // Retrieve Current Sharp ... + XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer; + XBoxZone tmpBoxes[]; + Copy( + obState.sharps, + tmpBoxes // + ); + idx = GetYoungest(tmpBoxes); + has = IsValidIndex(idx); + if (has) + { + // + currSharp = tmpBoxes[idx]; + bool isBullish = currSharp.IsBullish(); + + // + ArrayRemove( + tmpBoxes, + idx, + 1 // + ); + + // + while (HasChild(tmpBoxes)) + { + // + idx = GetYoungest(tmpBoxes); + has = IsValidIndex(idx); + + // + if (!has) + { + break; + } + + // + XBoxZone iBox = tmpBoxes[idx]; + ArrayRemove( + tmpBoxes, + idx, + 1 // + ); + + // + if (iBox.dir == currSharp.dir) + { + // + prevSharp = iBox; + iBox.Clean(); + break; + } + + // + iBox.Clean(); + } + + // + Clean(tmpBoxes); + } + Clean(tmpBoxes); + + // + has = currSharp.IsValid() && + prevSharp.IsValid(); + if (has) + { + // + XCBoxObject *iCurrObj; + XCBoxObject *iPrevObj; + has = drawer.DrawBox( + currSharp, + iCurrObj // + ); + has = + has && + drawer.DrawBox( + prevSharp, + iPrevObj // + ); + if (has) + { + // + Print("Sharp Detection ..."); + + // + iCurrObj.Delete(); + iPrevObj.Delete(); + + // + iCurrObj.Detach(); + iPrevObj.Detach(); + + // + ZeroMemory(iCurrObj); + ZeroMemory(iPrevObj); + } + } + } + // count = CountWaitingBoxes(); result = IsValidSize(count);