From 3acd8d355ff27b18a5a0ff2fcbc356025452822c Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 24 Jun 2024 11:58:37 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.x121.setup.xea.mq5 | 102 +++++++++++++++++--------- Experts/x-saherelm.x121.ea.mq5 | 6 +- 2 files changed, 71 insertions(+), 37 deletions(-) diff --git a/Classes/x-saherelm.x121.setup.xea.mq5 b/Classes/x-saherelm.x121.setup.xea.mq5 index 20e194fc..af63347d 100644 --- a/Classes/x-saherelm.x121.setup.xea.mq5 +++ b/Classes/x-saherelm.x121.setup.xea.mq5 @@ -3732,14 +3732,14 @@ public: mConditions, otherConditions // ); - AddRef( - lConditions, - otherConditions // - ); - AddRef( - hConditions, - otherConditions // - ); + // AddRef( + // lConditions, + // otherConditions // + // ); + // AddRef( + // hConditions, + // otherConditions // + // ); } // @@ -3757,14 +3757,14 @@ public: mConditions, otherConditions // ); - AddRef( - lConditions, - otherConditions // - ); - AddRef( - hConditions, - otherConditions // - ); + // AddRef( + // lConditions, + // otherConditions // + // ); + // AddRef( + // hConditions, + // otherConditions // + // ); } // @@ -3775,11 +3775,11 @@ public: // AddRef( - cConditions, + sConditions, otherConditions // ); AddRef( - sConditions, + lConditions, otherConditions // ); } @@ -3791,18 +3791,18 @@ public: signal = lSignal; // - AddRef( - cConditions, - otherConditions // - ); - AddRef( - sConditions, - otherConditions // - ); + // AddRef( + // cConditions, + // otherConditions // + // ); AddRef( mConditions, otherConditions // ); + AddRef( + hConditions, + otherConditions // + ); } // @@ -3820,6 +3820,18 @@ public: sConditions, otherConditions // ); + AddRef( + mConditions, + otherConditions // + ); + AddRef( + lConditions, + otherConditions // + ); + AddRef( + hConditions, + otherConditions // + ); } // @@ -5012,26 +5024,48 @@ private: int setupIDX = FindSetupIndex(positions[maxInDIDX].symbol); if (IsValidIndex(maxInDIDX) && IsValidIndex(setupIDX)) { + // + string iSymbol = positions[maxInDIDX].symbol; + ENUM_TIMEFRAMES iPeriod = mSetups[setupIDX].GetPeriod(); + // // Check Position Age ... int age = GetAge( positions[maxInDIDX], - mSetups[setupIDX].GetPeriod() // + iPeriod // ); if (age >= 700) { // - string comment = XEQMSupportToken + " Close Max In D ..."; - bool isClosed = mTrader.Close( - positions[maxInDIDX].ticket, - comment // + // Calculate Trend ... + XSCTrend *trend = new XSCTrend( + iSymbol, + iPeriod // ); - if (isClosed) + + // + XSCTrendInput tInputs; + tInputs.Default(); + bool canUseTrend = trend.Init(tInputs); + if (canUseTrend) { // - string message = XEQMSupportToken + " Close Position (" + ToString(positions[maxInDIDX].ticket) + ") Due Max In Drawdown ..."; - Alert(message); + trend.Draw(); + Print("UseTrend"); + trend.Remove(); } + + // string comment = XEQMSupportToken + " Close Max In D ..."; + // bool isClosed = mTrader.Close( + // positions[maxInDIDX].ticket, + // comment // + // ); + // if (isClosed) + // { + // // + // string message = XEQMSupportToken + " Close Position (" + ToString(positions[maxInDIDX].ticket) + ") Due Max In Drawdown ..."; + // Alert(message); + // } } } } diff --git a/Experts/x-saherelm.x121.ea.mq5 b/Experts/x-saherelm.x121.ea.mq5 index a22edfd7..5fadb9c7 100644 --- a/Experts/x-saherelm.x121.ea.mq5 +++ b/Experts/x-saherelm.x121.ea.mq5 @@ -74,7 +74,7 @@ input bool x121EACloseOnOpposit = false; // Close all Positions on Opposit // input group "Trailling"; -input bool x121EAAllowTrailStop = false; // Enable Trailling Stop Losses +input bool x121EAAllowTrailStop = true; // Enable Trailling Stop Losses input bool x121EADisableTrailingWhenOpposit = true; // Disable Trailling When has Opposite In Drawdown input double x121EAFirstTrailDistance = 100; // Start Trailling Distance input double x121EAFirstTrailPoint = 60; // First Stop Trail @@ -110,14 +110,14 @@ input double x121EAMaxAllowedRecoveryVolume = 0.08; // Max Allowed Recovery Sign // input group "Hedging"; -input int x121EARestingAfterHedge = 0; // Resting Seconds After Hedge +input int x121EARestingAfterHedge = 3000; // Resting Seconds After Hedge input double x121EAForceCloseProfit = 15; // Close All Positions Regardless of Policies when Profit Reached input double x121EAMaxDrawdownForce = 5; // Max Drawdown Force State for Handling Guards input int x121EAMaxPositionsForce = 10; // Max Number of Positions Force State for Handling Guards input double x121EAMinFreeMargingForHandleForce = 800; // Min Free Margin for Force States input double x121EAForceCloseOnEuityDiff = 15; // Force Close On Equity Differential input bool x121EAAllowSymbolHedgeOnForce = false; // Allow Symbol Hedging on Force States -input double x121EAMinRequiredProfitPerTrade = 0.5; // Minimum Required Profit for Hedging +input double x121EAMinRequiredProfitPerTrade = 0.2; // Minimum Required Profit for Hedging input double x121EAMinRequiredProfitPerVolumeFactor = 0.01; // Minimum Required Profit for Hedging Per Volume //