From aadcf4f64743cb76d2bd4f606f1ba08a23015bc2 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Tue, 30 Jul 2024 19:43:09 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.xstrategy.class.mq5 | 223 ++++++++++++++++ Experts/x-test-strategies.ea.mq5 | 14 +- Strategies/x-saherelm.xchkm.strategy.mq5 | 310 ++++------------------- 3 files changed, 284 insertions(+), 263 deletions(-) diff --git a/Classes/x-saherelm.xstrategy.class.mq5 b/Classes/x-saherelm.xstrategy.class.mq5 index b237406d..a5d8ef68 100644 --- a/Classes/x-saherelm.xstrategy.class.mq5 +++ b/Classes/x-saherelm.xstrategy.class.mq5 @@ -413,6 +413,229 @@ public: mDrawImportantAreas = value; } + // + // Important Areas Getters ... + + // + bool GetSupport( + XOHCL &bar // + ) + { + // + bool result = false; + + // + bar.Clean(); + + // + result = support.IsValid(); + if (result) + { + bar = support; + } + + // + return result; + } + + // + bool GetResistance( + XOHCL &bar // + ) + { + // + bool result = false; + + // + bar.Clean(); + + // + result = resistance.IsValid(); + if (result) + { + bar = resistance; + } + + // + return result; + } + + // + bool GetBullishOB( + XOHCL &bar // + ) + { + // + bool result = false; + + // + bar.Clean(); + + // + result = bullishOB.IsValid(); + if (result) + { + bar = bullishOB; + } + + // + return result; + } + + // + bool GetBearishOB( + XOHCL &bar // + ) + { + // + bool result = false; + + // + bar.Clean(); + + // + result = bearishOB.IsValid(); + if (result) + { + bar = bearishOB; + } + + // + return result; + } + + // + bool GetBullishFVG( + XOHCL &bar, + double upper, + double lower // + ) + { + // + bool result = false; + + // + upper = 0; + lower = 0; + bar.Clean(); + + // + result = bullishFVG.IsValid(); + if (result) + { + // + bar = bullishFVG; + upper = bullishFVGUpper; + lower = bullishFVGLower; + } + + // + return result; + } + + // + bool GetBearishFVG( + XOHCL &bar, + double upper, + double lower // + ) + { + // + bool result = false; + + // + upper = 0; + lower = 0; + bar.Clean(); + + // + result = bearishFVG.IsValid(); + if (result) + { + // + bar = bearishFVG; + upper = bearishFVGUpper; + lower = bearishFVGLower; + } + + // + return result; + } + + // + bool GetBullishTrend( + XOHCL &bar, + XOHCL &swingHighs[], + XOHCL &swingLows[] // + ) + { + // + bool result = false; + + // + bar.Clean(); + Clean(swingHighs); + Clean(swingLows); + + // + result = bullishTrend.IsValid(); + if (result) + { + // + bar = bullishTrend; + + // + Copy( + bullishTrendSwingHighs, + swingHighs // + ); + Copy( + bullishTrendSwingLows, + swingLows // + ); + } + + // + return result; + } + + // + bool GetBearishTrend( + XOHCL &bar, + XOHCL &swingHighs[], + XOHCL &swingLows[] // + ) + { + // + bool result = false; + + // + bar.Clean(); + Clean(swingHighs); + Clean(swingLows); + + // + result = bearishTrend.IsValid(); + if (result) + { + // + bar = bearishTrend; + + // + Copy( + bearishTrendSwingHighs, + swingHighs // + ); + Copy( + bearishTrendSwingLows, + swingLows // + ); + } + + // + return result; + } + // // Virtual Methods ... diff --git a/Experts/x-test-strategies.ea.mq5 b/Experts/x-test-strategies.ea.mq5 index 0f636a81..a417c8e4 100644 --- a/Experts/x-test-strategies.ea.mq5 +++ b/Experts/x-test-strategies.ea.mq5 @@ -45,8 +45,8 @@ int eaMaxAllowedLongs = 1; // Max Allowed Long Positions int eaMaxAllowedShorts = 1; // Max Allowed Short Positions // -input double eaTPPoint = 100; // Static TP Point -input double eaSLPoint = 100; // Static SL Point +double eaTPPoint = 150; // Static TP Point +double eaSLPoint = 100; // Static SL Point // bool eaIgnoreTP = false; // Ignore TP @@ -277,16 +277,16 @@ bool InitialEA() // // Configure Trailing ... eaTradeHandler.AllowTrailStops(false); - eaTradeHandler.TrailStepInPoint(10); - eaTradeHandler.TrailStartInPoint(20); + eaTradeHandler.TrailStepInPoint(30); + eaTradeHandler.TrailStartInPoint(100); eaTradeHandler.IgnoreTPOnTrail(true); eaTradeHandler.TrailBasedOnProfit(true); // // Configure Recovery ... eaTradeHandler.AllowRecover(false); - eaTradeHandler.RecoveryTPPoint(50); - eaTradeHandler.MaxAllowedRecover(3); + eaTradeHandler.RecoveryTPPoint(300); + eaTradeHandler.MaxAllowedRecover(0); eaTradeHandler.MaxAllowedRecoveryVolume(0.1); eaTradeHandler.RecoverySLPoint(200); eaTradeHandler.RecoveryVolumeMultiplier(2); @@ -321,7 +321,7 @@ bool InitialEA() xchmStrategy.EnableXCHM(true); xchmStrategy.EnableXCHHK(true); xchmStrategy.EnableXCHSTR(true); - xchmStrategy.EnableXCHCHE(true); + xchmStrategy.EnableXCHCHE(false); xchmStrategy.SetAlertLogAlerts(true); xchmStrategy.DrawImportantAreas(false); xchmStrategy.SetAlertEnableAlerts(true); diff --git a/Strategies/x-saherelm.xchkm.strategy.mq5 b/Strategies/x-saherelm.xchkm.strategy.mq5 index dd8d6f49..1652b2a3 100644 --- a/Strategies/x-saherelm.xchkm.strategy.mq5 +++ b/Strategies/x-saherelm.xchkm.strategy.mq5 @@ -160,229 +160,6 @@ public: mEnableXCHSTR = value; } - // - // Important Areas Getters ... - - // - bool GetSupport( - XOHCL &bar // - ) - { - // - bool result = false; - - // - bar.Clean(); - - // - result = support.IsValid(); - if (result) - { - bar = support; - } - - // - return result; - } - - // - bool GetResistance( - XOHCL &bar // - ) - { - // - bool result = false; - - // - bar.Clean(); - - // - result = resistance.IsValid(); - if (result) - { - bar = resistance; - } - - // - return result; - } - - // - bool GetBullishOB( - XOHCL &bar // - ) - { - // - bool result = false; - - // - bar.Clean(); - - // - result = bullishOB.IsValid(); - if (result) - { - bar = bullishOB; - } - - // - return result; - } - - // - bool GetBearishOB( - XOHCL &bar // - ) - { - // - bool result = false; - - // - bar.Clean(); - - // - result = bearishOB.IsValid(); - if (result) - { - bar = bearishOB; - } - - // - return result; - } - - // - bool GetBullishFVG( - XOHCL &bar, - double upper, - double lower // - ) - { - // - bool result = false; - - // - upper = 0; - lower = 0; - bar.Clean(); - - // - result = bullishFVG.IsValid(); - if (result) - { - // - bar = bullishFVG; - upper = bullishFVGUpper; - lower = bullishFVGLower; - } - - // - return result; - } - - // - bool GetBearishFVG( - XOHCL &bar, - double upper, - double lower // - ) - { - // - bool result = false; - - // - upper = 0; - lower = 0; - bar.Clean(); - - // - result = bearishFVG.IsValid(); - if (result) - { - // - bar = bearishFVG; - upper = bearishFVGUpper; - lower = bearishFVGLower; - } - - // - return result; - } - - // - bool GetBullishTrend( - XOHCL &bar, - XOHCL &swingHighs[], - XOHCL &swingLows[] // - ) - { - // - bool result = false; - - // - bar.Clean(); - Clean(swingHighs); - Clean(swingLows); - - // - result = bullishTrend.IsValid(); - if (result) - { - // - bar = bullishTrend; - - // - Copy( - bullishTrendSwingHighs, - swingHighs // - ); - Copy( - bullishTrendSwingLows, - swingLows // - ); - } - - // - return result; - } - - // - bool GetBearishTrend( - XOHCL &bar, - XOHCL &swingHighs[], - XOHCL &swingLows[] // - ) - { - // - bool result = false; - - // - bar.Clean(); - Clean(swingHighs); - Clean(swingLows); - - // - result = bearishTrend.IsValid(); - if (result) - { - // - bar = bearishTrend; - - // - Copy( - bearishTrendSwingHighs, - swingHighs // - ); - Copy( - bearishTrendSwingLows, - swingLows // - ); - } - - // - return result; - } - // // Overrides ... @@ -885,7 +662,9 @@ public: // hasBullishPower && cBar.IsBullish() && + cBar.low > chcheMinBullish && chcheConditions.isBullishPowerUp && + chcheConditions.isCStrongBearish && (chmConditions.hasBullishPower || chhkConditions.hasBullishPower || chstrConditions.hasBullishPower) @@ -921,7 +700,9 @@ public: // hasBearishPower && cBar.IsBearish() && + cBar.high < chcheMaxBearish && chcheConditions.isBearishPowerUp && + chcheConditions.isCStrongBearish && (chmConditions.hasBearishPower || chhkConditions.hasBearishPower || chstrConditions.hasBearishPower) @@ -961,6 +742,23 @@ public: return result; } + // + result = + // + (hasLong && + bullishTrend.IsValid()) + // + || + // + (!hasLong && + bearishTrend.IsValid()) + // + ; + if (!result) + { + return result; + } + // DestroyImportantAreas(); @@ -1106,7 +904,7 @@ private: pvInputs.hcPeriod = hcPeriod; // - pvInputs.showPeaksAndVales = true; + pvInputs.showPeaksAndVales = false; pvInputs.showLevels = false; pvInputs.showConsolidations = false; pvInputs.showFibo1Levels = false; @@ -1140,8 +938,8 @@ private: chmInputs.hcPeriod = hcPeriod; // - chmInputs.showFast = true; - chmInputs.showSlow = true; + chmInputs.showFast = false; + chmInputs.showSlow = false; chmInputs.showCCFast = false; chmInputs.showCCSlow = false; chmInputs.showSCFast = false; @@ -1181,11 +979,11 @@ private: chhkInputs.ignoreShadows = true; // - chhkInputs.showCurrent = true; - chhkInputs.showShort = true; - chhkInputs.showMedium = true; - chhkInputs.showLong = true; - chhkInputs.showHind = true; + chhkInputs.showCurrent = false; + chhkInputs.showShort = false; + chhkInputs.showMedium = false; + chhkInputs.showLong = false; + chhkInputs.showHind = false; // chhkHelper = new XSCXCHHKHelper(); @@ -1212,11 +1010,11 @@ private: chstrInputs.hcPeriod = hcPeriod; // - chstrInputs.showCurrent = true; - chstrInputs.showShort = true; - chstrInputs.showMedium = true; - chstrInputs.showLong = true; - chstrInputs.showHind = true; + chstrInputs.showCurrent = false; + chstrInputs.showShort = false; + chstrInputs.showMedium = false; + chstrInputs.showLong = false; + chstrInputs.showHind = false; // chstrHelper = new XSCXCHSTRHelper(); @@ -1233,26 +1031,26 @@ private: chcheInputs.Default(); // - chcheInputs.showCurrentLE1 = true; - chcheInputs.showCurrentLE2 = true; - chcheInputs.showCurrentSE1 = true; - chcheInputs.showCurrentSE2 = true; - chcheInputs.showShortLE1 = true; - chcheInputs.showShortLE2 = true; - chcheInputs.showShortSE1 = true; - chcheInputs.showShortSE2 = true; - chcheInputs.showMediumLE1 = true; - chcheInputs.showMediumLE2 = true; - chcheInputs.showMediumSE1 = true; - chcheInputs.showMediumSE2 = true; - chcheInputs.showLongLE1 = true; - chcheInputs.showLongLE2 = true; - chcheInputs.showLongSE1 = true; - chcheInputs.showLongSE2 = true; - chcheInputs.showHindLE1 = true; - chcheInputs.showHindLE2 = true; - chcheInputs.showHindSE1 = true; - chcheInputs.showHindSE2 = true; + chcheInputs.showCurrentLE1 = false; + chcheInputs.showCurrentLE2 = false; + chcheInputs.showCurrentSE1 = false; + chcheInputs.showCurrentSE2 = false; + chcheInputs.showShortLE1 = false; + chcheInputs.showShortLE2 = false; + chcheInputs.showShortSE1 = false; + chcheInputs.showShortSE2 = false; + chcheInputs.showMediumLE1 = false; + chcheInputs.showMediumLE2 = false; + chcheInputs.showMediumSE1 = false; + chcheInputs.showMediumSE2 = false; + chcheInputs.showLongLE1 = false; + chcheInputs.showLongLE2 = false; + chcheInputs.showLongSE1 = false; + chcheInputs.showLongSE2 = false; + chcheInputs.showHindLE1 = false; + chcheInputs.showHindLE2 = false; + chcheInputs.showHindSE1 = false; + chcheInputs.showHindSE2 = false; // chcheHelper = new XSCXCHCHEHelper();