From a02bf1ba1374455d21e05e032d892d63869a9e62 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 12 May 2025 07:43:24 +0330 Subject: [PATCH] last ... --- Libraries/x-saherelm.x-poi.lib.mq5 | 59 +++++++++++++++++ XCAEA/Libraries/xcaea.signaller.lib.mq5 | 87 +++++++++++++++++++++++-- XCAEA/Signals/xcaea.signaller.class.mq5 | 33 ++++++---- 3 files changed, 161 insertions(+), 18 deletions(-) diff --git a/Libraries/x-saherelm.x-poi.lib.mq5 b/Libraries/x-saherelm.x-poi.lib.mq5 index b8620d4f..dc06f660 100644 --- a/Libraries/x-saherelm.x-poi.lib.mq5 +++ b/Libraries/x-saherelm.x-poi.lib.mq5 @@ -5588,6 +5588,65 @@ struct XBoxZone // double diffAvg = (upper - lower) / 2; result = lower + diffAvg; + result = NormalizePrice(result, symbol); + + // + return result; + } + + /** + * Calculate Box Leg N Price ... + * N default is 2 + * + * @param leg: int ... + * + * @return ( double ) + */ + double GetLeg(int leg = 2) + { + // + double result = 0; + + // + leg = NormalizeInt(leg, 2); + + // + if (!IsValid()) + { + return result; + } + + // + double range = (upper - lower) * leg; + result = + IsBullish() + ? upper + range + : lower - range; + result = NormalizePrice(result, symbol); + + // + return result; + } + + /** + * Calculate Box Range ... + * + * @return ( double ) + */ + double GetRange() + { + // + double result = 0; + + // + if (!IsValid()) + { + return result; + } + + // + result = (upper - lower); + result = NormalizePrice(result, symbol); // return result; diff --git a/XCAEA/Libraries/xcaea.signaller.lib.mq5 b/XCAEA/Libraries/xcaea.signaller.lib.mq5 index 6dbf9993..f19c59a9 100644 --- a/XCAEA/Libraries/xcaea.signaller.lib.mq5 +++ b/XCAEA/Libraries/xcaea.signaller.lib.mq5 @@ -1773,10 +1773,75 @@ bool CanTriggerCond3( barIndex // ); + // + // Initialize iBar ... + XOHCL iBar; + result = iBar.Init( + symbol, + period, + barIndex // + ); + if (!result) + { + // + iBar.Clean(); + + // + return result; + } + // // Validate Box ... // For Box Validating we use 50% of Box Range ... // if Price Touched Box 50% rate we Invalidate Box ... + // r if Prce Touched Leg 2 of Box Size ... + double boxLeg2 = box.GetLeg(2); + + // + // Draw Box Leg2 ... + string iLeg2Name = box.GetMiddleTag(); + StringReplace( + iLeg2Name, + "Mid", + "Leg2" // + ); + CChartObjectTrend *iLeg2Obj; + iLeg2Obj = new CChartObjectTrend(); + has = iLeg2Obj.Create( + helper.poiDrawer.ChartIdentification(), + iLeg2Name, + helper.poiDrawer.SubWindowIdentification(), + box.from, + boxLeg2, + box.to, + boxLeg2 // + ); + if (has) + { + // + iLeg2Obj.Color(clrYellow); + + // + drawns.Add(iLeg2Obj); + } + ZeroMemory(iLeg2Obj); + + // + bool isBoxValid = + isBullish + ? iBar.close < boxLeg2 + : iBar.close > boxLeg2; + result = isBoxValid; + if (!result) + { + // + box.Clean(); + iBar.Clean(); + + // + return result; + } + iBar.Clean(); // // Detect Box FVG ... @@ -1890,11 +1955,6 @@ bool CanTriggerCond3( result = !isBreaked; if (!result) { - // - // Here We Can Cleanup Decision Zone ... - // since the Conditions Destructed ... - // box.Clean(); - // fvg.Clean(); Clean(fvgs); @@ -1930,7 +1990,6 @@ bool CanTriggerCond3( // // Detecting Liquiidties ... - XOHCL iBar; XCAEALQSweep iLQ; XCAEALQSweep lqs[]; toIDX = fvg.ToIndex(); @@ -2311,6 +2370,22 @@ bool CanTriggerCond3( // Since Here TP Must Calculated // Using R2R we Ignore Target ... tp = 0; + + // + // Add Target if price is Inside Analyse Box ... + double price = iBar.close; + double target = + isBullish + ? box.upper + : box.lower; + has = + isBullish + ? price < target + : price > target; + if (has) + { + tp = target; + } } // diff --git a/XCAEA/Signals/xcaea.signaller.class.mq5 b/XCAEA/Signals/xcaea.signaller.class.mq5 index 7a553f4d..79e13ba8 100644 --- a/XCAEA/Signals/xcaea.signaller.class.mq5 +++ b/XCAEA/Signals/xcaea.signaller.class.mq5 @@ -775,11 +775,7 @@ class XCXCAEASignaller : XCBase inputs.ctInputs.showCandleTime = true; // - // XCA ... - - // - inputs.caInputs.supResSmoothingLength = 7; - inputs.caInputs.supResSmoothingMode = X_MA_MODE_NONE; + // X3MA ... // inputs.x3maInputs.applyColor = true; @@ -793,10 +789,25 @@ class XCXCAEASignaller : XCBase inputs.x3maInputs.showMedium = false; // + // XCA ... + + // + inputs.caInputs.sarStep = 0.001; + inputs.caInputs.sarMax = 0.05; + + // + inputs.caInputs.supResSmoothingLength = 7; + inputs.caInputs.supResSmoothingMode = X_MA_MODE_NONE; + + // + inputs.caInputs.showKI = false; + inputs.caInputs.showTKI = false; inputs.caInputs.showMAH = false; inputs.caInputs.showMAL = false; inputs.caInputs.showMAC = false; - inputs.caInputs.showSar = false; + inputs.caInputs.showSar = true; + inputs.caInputs.showVidya = false; + inputs.caInputs.showTrend = false; inputs.caInputs.showSwings = true; inputs.caInputs.showFiboLevel1 = false; inputs.caInputs.showFiboLevel2 = false; @@ -804,12 +815,6 @@ class XCXCAEASignaller : XCBase inputs.caInputs.showFiboLevel4 = false; inputs.caInputs.showFiboLevel5 = false; inputs.caInputs.showPeaksAndVales = true; - - // - inputs.caInputs.showKI = false; - inputs.caInputs.showTKI = false; - inputs.caInputs.showVidya = false; - inputs.caInputs.showTrend = false; inputs.caInputs.showPeakAndValeGolden = false; inputs.caInputs.showSupportAndResistance = false; @@ -833,6 +838,10 @@ class XCXCAEASignaller : XCBase inputs.showADX = false; inputs.showMACD = false; + // + // + // + // // XCAEA Helper ... helper = new XCXCAEAHelper();