From cc0c0872bcdc6a1646057483862d2dcdd39a0804 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Thu, 9 Oct 2025 13:19:23 +0330 Subject: [PATCH] last ... --- .../x-saherelm.x-backtester.expert.class.mq5 | 13 ++ .../x-saherelm.xfima.signaller.class.mq5 | 135 ++++++++++++------ 2 files changed, 108 insertions(+), 40 deletions(-) diff --git a/Classes/x-saherelm.x-backtester.expert.class.mq5 b/Classes/x-saherelm.x-backtester.expert.class.mq5 index 9fecf496..2cd28622 100644 --- a/Classes/x-saherelm.x-backtester.expert.class.mq5 +++ b/Classes/x-saherelm.x-backtester.expert.class.mq5 @@ -621,6 +621,19 @@ class XCBackTesterEA : public XCBase */ void HandleOnSignalTriggered(XSignal &signal) { + // + // Draw Signal ... + XCSignalObject *iSignalObj = new XCSignalObject(); + bool isCreated = iSignalObj.Create( + eaChartHelper.ChartId(), + 0, + signal, + 3 // + ); + if (isCreated) + { + } + // // Handle Volume ... double iVolume = eaVolume.CalculateVolume(signal); diff --git a/XFIMAEA/Classes/x-saherelm.xfima.signaller.class.mq5 b/XFIMAEA/Classes/x-saherelm.xfima.signaller.class.mq5 index c248d5ff..27eccd1c 100644 --- a/XFIMAEA/Classes/x-saherelm.xfima.signaller.class.mq5 +++ b/XFIMAEA/Classes/x-saherelm.xfima.signaller.class.mq5 @@ -554,12 +554,14 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller // // Testing Porposes ... - result = fimaHelper.IsBoundaryFakeBreaked( - dir, - bar.Index(), - X_PRICE_CLOSE, - X_PRICE_CLOSE // - ); + result = + result && + fimaHelper.IsBoundaryFakeBreaked( + dir, + bar.Index(), + X_PRICE_CLOSE, + X_PRICE_CLOSE // + ); // // Nearest Noisy ZG Pivot Must has Same Direction @@ -709,6 +711,18 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller ? bullishScore > bearishScore : bearishScore > bullishScore; + // + // Last Validation is Candlestick Patterns of Bar ... + // XPatternAnalysis barAnalysis; + // result = + // result && + // poiDetector.AnalyseBarPatterns( + // bar, + // barAnalysis, + // structureConfig.barsAnalysisConfig // + // ); + + // if (!result) { // @@ -719,59 +733,100 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller } // - // Validating ... - // Print("Validate ZG ..."); + // Drawa ... + if (result) + { + // + // Affected Zone ... + XCBoxObject *iObj; + has = poiDrawer.DrawBox( + affectedZone, + iObj, + true, + affectedZone.type + "_" + ToXString(TimeToSeconds(affectedZone.from)) // + ); + if (has) + { + // + XPOIStyle iStyle; + poiDrawer.GetBoxStyle( + iStyle, + affectedZone.dir // + ); + iStyle.clr = clrYellow; + poiDrawer.ApplyBoxStyle( + iObj, + iStyle // + ); + iStyle.Clean(); - // // - // dir = X_DIRECTION_NONE; - // result = false; + // + Print("Affected Zone ..."); + } + + // + // Draw Bar Pattern ... + // poiDrawer.DrawPatternAnalysis(barAnalysis, structureDrawConfig.barAnalysisDrawConfig); + } // // Prepare zone ... if (result) { // - zone.to = bar.time; - zone.from = GetBarTime( - bar.symbol, - bar.period, - bar.Index() + 2 // - ); - zone.dir = dir; - zone.symbol = bar.symbol; - zone.period = bar.period; + zone = affectedZone; + + // zone.type = name + "_" + ToXString(dir); - // zone.lower = bar.FindLowest(2, MODE_LOW); - // zone.upper = bar.FindHighest(2, MODE_HIGH); + + // double entry = GetEntry(bar.symbol, dir); double points = GetPoints(bar.symbol); - zone.lower = entry - (100 * points); - zone.upper = entry + (100 * points); + double risk = MathAbs(entry - (isBullish ? zone.lower : zone.upper)); + double reward = risk * defaultSignalR2R; // + // Partially Close on TP 1 ... double tp1 = isBullish - ? entry + (100 * points) - : entry - (100 * points); + ? entry + (risk * 1) + : entry - (risk * 1); XTarget target1; target1.target = tp1; - target1.doRF = true; - target1.actingDistance = 10; + target1.doRF = false; + target1.actingDistance = 2; + target1.volumeMultiplier = 0.5; - double tp2 = isBullish - ? entry + (200 * points) - : entry - (200 * points); - XTarget target2; - target2.target = tp2; - target2.doRF = true; - target2.actingDistance = 10; + // + // TP 3 ... + double tp3 = isBullish + ? entry + (risk * 3) + : entry - (risk * 3); + XTarget target3; + target3.target = tp3; + target3.doRF = true; + target3.actingDistance = 10; + + // + // TP 5 ... + double tp5 = isBullish + ? entry + (risk * 5) + : entry - (risk * 5); + XTarget target5; + target5.target = tp5; + target5.doRF = true; + target5.actingDistance = 10; // - // AddRef( - // target1, - // targets // - // ); AddRef( - target2, + target1, + targets // + ); + AddRef( + target3, + targets // + ); + AddRef( + target5, targets // );