From 72dc9737f9a845b7f9b8d9821011a33f53cb5396 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 27 May 2024 10:52:50 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.x121.xea.class.mq5 | 35 +++++++++++++++++++++------ Experts/x-test.x121ea.mq5 | 6 ++--- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Classes/x-saherelm.x121.xea.class.mq5 b/Classes/x-saherelm.x121.xea.class.mq5 index 613dfa77..e92b26f2 100644 --- a/Classes/x-saherelm.x121.xea.class.mq5 +++ b/Classes/x-saherelm.x121.xea.class.mq5 @@ -457,7 +457,7 @@ public: // Make them Configurable ... int levelsOnClose = 6; int requiredAgeForTrail = 0; - int requiredDistanceForTrail = 5; + int requiredDistanceForTrail = 30; // int positionsCount = ArraySize(positions); @@ -531,8 +531,8 @@ public: // double sl = IsLong(iPosition.type) - ? iPosition.sl + slDiff - : iPosition.sl - slDiff; + ? iPosition.sl + appliedSL + : iPosition.sl - appliedSL; // // double sl = @@ -717,12 +717,13 @@ public: // double tpDiff = PointToPrice(priceDistance, iPosition.symbol); + double appliedTP = tpDiff / 2; // double tp = IsLong(iPosition.type) - ? iPosition.tp - tpDiff - : iPosition.tp + tpDiff; + ? iPosition.tp - appliedTP + : iPosition.tp + appliedTP; // bool isInit = trail.Init( @@ -772,12 +773,13 @@ public: // double tpDiff = PointToPrice(priceDistance, iPosition.symbol); + double appliedTP = tpDiff / 2; // double tp = isLong - ? iPosition.tp - tpDiff - : iPosition.tp + tpDiff; + ? iPosition.tp - appliedTP + : iPosition.tp + appliedTP; // // Update Trail Values ... @@ -827,6 +829,10 @@ public: // for Volumes and Benefits ... int HandleSignalManagement(XSignal &signals[]) override { + // + // TODO: Make this Configurable ... + int minDistanceBetweenTwoSameProviderSignal = 7; + // int result = 0; @@ -910,7 +916,20 @@ public: else if (positionsCount < 2) { // - // First Signal in a While of Specific Provider ... + // Next Signal in a While of Specific Provider ... + + // + // Find Longest Position and Check it's Age ... + // Compare it by min age for same provider signals ... + XPosition youngest; + int youngestAge = GetYoungest( + youngest, + positions // + ); + if (youngestAge == -1 || youngestAge < minDistanceBetweenTwoSameProviderSignal) + { + continue; + } // AddRef( diff --git a/Experts/x-test.x121ea.mq5 b/Experts/x-test.x121ea.mq5 index fdddc9fe..3b97eb81 100644 --- a/Experts/x-test.x121ea.mq5 +++ b/Experts/x-test.x121ea.mq5 @@ -195,7 +195,7 @@ bool InitialEA() Add(X110, signallers); Add(X121, signallers); Add(X128, signallers); - Add(X92, signallers); + // Add(X92, signallers); // GetAllX121SignalProviders(signallers); // @@ -330,8 +330,8 @@ void ConfigureDescriptor( // // XZG ... - iDescriptor.inputs.zgInputs.showZigZag = false; - iDescriptor.inputs.zgInputs.showPeaksAndVales = false; + iDescriptor.inputs.zgInputs.showZigZag = true; + iDescriptor.inputs.zgInputs.showPeaksAndVales = true; // // XDON ...