From b1b2ef36ec615afee38e1f13e3828f343e80c049 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Wed, 5 Jun 2024 16:31:08 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.x121.provider.class.mq5 | 259 +++++++++++++++++++++ Experts/x-test.x121ea.mq5 | 70 +++--- 2 files changed, 302 insertions(+), 27 deletions(-) diff --git a/Classes/x-saherelm.x121.provider.class.mq5 b/Classes/x-saherelm.x121.provider.class.mq5 index 213f0b07..68c3edbb 100644 --- a/Classes/x-saherelm.x121.provider.class.mq5 +++ b/Classes/x-saherelm.x121.provider.class.mq5 @@ -1736,6 +1736,265 @@ struct X121ProviderDescriptor return result; } + // + // Try to Normalize SL and TP ... + + // + // For Longs ... + if (hasLong) { + // + // Collect all Verifications SLs ... + + // + double sls[]; + double tps[]; + + // + // Current Market ... + + // + if (cLNSL > 0) { + // + Add( + cLNSL, + sls // + ); + } + + // + if (cLNTP > 0) { + // + Add( + cLNTP, + tps // + ); + } + + // + // Short Market ... + + // + if (sLNSL > 0) { + // + Add( + sLNSL, + sls // + ); + } + + // + if (sLNTP > 0) { + // + Add( + sLNTP, + tps // + ); + } + + // + // Medium Market ... + + // + if (mLNSL > 0) { + // + Add( + mLNSL, + sls // + ); + } + + // + if (mLNTP > 0) { + // + Add( + mLNTP, + tps // + ); + } + + // + // Long Market ... + + // + if (lLNSL > 0) { + // + Add( + lLNSL, + sls // + ); + } + + // + if (lLNTP > 0) { + // + Add( + lLNTP, + tps // + ); + } + + // + // Hind Market ... + + // + if (hLNSL > 0) { + // + Add( + hLNSL, + sls // + ); + } + + // + if (hLNTP > 0) { + // + Add( + hLNTP, + tps // + ); + } + + // + // Now Select Minimum SL ... + if (IsValidSize(ArraySize(sls))) { + slPrice = GetMin(sls); + } + + // + // Average TP ... + if (IsValidSize(ArraySize(tps))) { + tpPrice = GetAverage(tps); + } + } + + // + // For Shorts ... + if (hasShort) { + // + // Collect all Verifications SLs ... + + // + double sls[]; + double tps[]; + + // + // Current Market ... + + // + if (cSHSL > 0) { + // + Add( + cSHSL, + sls // + ); + } + + // + if (cSHTP > 0) { + // + Add( + cSHTP, + tps // + ); + } + + // + // Short Market ... + + // + if (sSHSL > 0) { + // + Add( + sSHSL, + sls // + ); + } + + // + if (sSHTP > 0) { + // + Add( + sSHTP, + tps // + ); + } + + // + // Medium Market ... + + // + if (mSHSL > 0) { + // + Add( + mSHSL, + sls // + ); + } + + // + if (mSHTP > 0) { + // + Add( + mSHTP, + tps // + ); + } + + // + // Long Market ... + + // + if (lSHSL > 0) { + // + Add( + lSHSL, + sls // + ); + } + + // + if (lSHTP > 0) { + // + Add( + lSHTP, + tps // + ); + } + + // + // Hind Market ... + + // + if (hSHSL > 0) { + // + Add( + hSHSL, + sls // + ); + } + + // + if (hSHTP > 0) { + // + Add( + hSHTP, + tps // + ); + } + + // + // Now Select Minimum SL ... + if (IsValidSize(ArraySize(sls))) { + slPrice = GetMin(sls); + } + + // + // Average TP ... + if (IsValidSize(ArraySize(tps))) { + tpPrice = GetAverage(tps); + } + } + // // Generate Signal ... this.signal.Clean(); diff --git a/Experts/x-test.x121ea.mq5 b/Experts/x-test.x121ea.mq5 index 0e89fe72..d91f824c 100644 --- a/Experts/x-test.x121ea.mq5 +++ b/Experts/x-test.x121ea.mq5 @@ -204,6 +204,39 @@ bool InitialEA() // mX121EA.SetAlertPrefix(ShortName); + // + // Prepare Signallers ... + + // + // X786 Signaller ... + X786Signaller *x786Signaller = new X786Signaller(); + x786Signaller.Default(); + x786Signaller.allowLong = x121EAAllowLong; + x786Signaller.allowShort = x121EAAllowShort; + x786Signaller.minRequiredProfitPerTrade = 0; + x786Signaller.openNextPositionOnProfit = false; + x786Signaller.delayBetweenTwoSameTypeSignals = 6; + + // + // X121 Signaller ... + X121Signaller *x121Signaller = new X121Signaller(); + x121Signaller.Default(); + x121Signaller.allowLong = x121EAAllowLong; + x121Signaller.allowShort = x121EAAllowShort; + x121Signaller.minRequiredProfitPerTrade = 0; + x121Signaller.openNextPositionOnProfit = false; + x121Signaller.delayBetweenTwoSameTypeSignals = 6; + + // + // X110 Signaller ... + X110Signaller *x110Signaller = new X110Signaller(); + x110Signaller.Default(); + x110Signaller.allowLong = x121EAAllowLong; + x110Signaller.allowShort = x121EAAllowShort; + x110Signaller.minRequiredProfitPerTrade = 0; + x110Signaller.openNextPositionOnProfit = false; + x110Signaller.delayBetweenTwoSameTypeSignals = 6; + // // Prepare Providers and Add them into mX121EA class ... for (int i = 0; i < symbolsCount; i++) @@ -222,36 +255,14 @@ bool InitialEA() iDescriptor.period = iPeriod; // - // Prepare Signallers ... + // Attach Signallers ... + + // Clean(iDescriptor.signallers); // ArrayResize(iDescriptor.signallers, 3); - // - // X786 Signaller ... - X786Signaller *x786Signaller = new X786Signaller(); - x786Signaller.Default(); - x786Signaller.allowLong = false; // x121EAAllowLong; - x786Signaller.allowShort = false; // x121EAAllowShort; - - // - // X121 Signaller ... - X121Signaller *x121Signaller = new X121Signaller(); - x121Signaller.Default(); - x121Signaller.allowLong = false; // x121EAAllowLong; - x121Signaller.allowShort = false; // x121EAAllowShort; - - // - // X110 Signaller ... - X110Signaller *x110Signaller = new X110Signaller(); - x110Signaller.Default(); - x110Signaller.allowLong = x121EAAllowLong; - x110Signaller.allowShort = x121EAAllowShort; - x110Signaller.minRequiredProfitPerTrade = 1.5; - x110Signaller.openNextPositionOnProfit = false; - x110Signaller.delayBetweenTwoSameTypeSignals = 6; - // iDescriptor.signallers[0] = x786Signaller; iDescriptor.signallers[1] = x121Signaller; @@ -1017,8 +1028,8 @@ void ApplyPreDefineConfigurations(X121ProviderDescriptor &iDescriptor) iDescriptor.inputs.mcInputs.showVerifierMa = isX110; // - iDescriptor.inputs.ichInputs.showKumo = true; // isX110; - iDescriptor.inputs.ichInputs.showKijunSen = true; // isX110; + iDescriptor.inputs.ichInputs.showKumo = true; // isX110; + iDescriptor.inputs.ichInputs.showKijunSen = true; // isX110; iDescriptor.inputs.ichInputs.showTenkanSen = true; // isX110; iDescriptor.inputs.ichInputs.showSenkouSpanA = isX110; iDescriptor.inputs.ichInputs.showSenkouSpanB = isX110; @@ -1037,6 +1048,11 @@ void ApplyPreDefineConfigurations(X121ProviderDescriptor &iDescriptor) iDescriptor.inputs.pvInputs.showFibo4Levels = isX110; iDescriptor.inputs.pvInputs.showFibo5Levels = isX110; } + + // + iDescriptor.inputs.ichInputs.showKumo = true; // isX110; + iDescriptor.inputs.ichInputs.showKijunSen = true; // isX110; + iDescriptor.inputs.ichInputs.showTenkanSen = true; // isX110; } // \ No newline at end of file