diff --git a/Classes/x-saherelm.x121.setup.xea.mq5 b/Classes/x-saherelm.x121.setup.xea.mq5 index 1e2f2f59..3cfad5b6 100644 --- a/Classes/x-saherelm.x121.setup.xea.mq5 +++ b/Classes/x-saherelm.x121.setup.xea.mq5 @@ -5009,23 +5009,36 @@ private: int maxInDIDX = FindMaxDrawdownIndex( positions // ); - if (IsValidIndex(maxInDIDX)) + int setupIDX = FindSetupIndex(positions[maxInDIDX].symbol); + if (IsValidIndex(maxInDIDX) && IsValidIndex(setupIDX)) { // - string comment = XEQMSupportToken + " Close Max In D ..."; - bool isClosed = mTrader.Close( - positions[maxInDIDX].ticket, - comment // - ); - if (isClosed) + // Check Position Age ... + int age = GetAge( + positions[maxInDIDX], + mSetups[setupIDX].GetPeriod();); + if (age >= 700) { // - string message = XEQMSupportToken + " Close Position (" + ToString(positions[maxInDIDX].ticket) + ") Due Max In Drawdown ..."; - Alert(message); + 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); + } } } } + // + // Find Max In Profit ... + // and Min In Profit ... + // }