diff --git a/Classes/x-saherelm.x121.setup.xea.mq5 b/Classes/x-saherelm.x121.setup.xea.mq5 index b73d1ac4..a99e1e44 100644 --- a/Classes/x-saherelm.x121.setup.xea.mq5 +++ b/Classes/x-saherelm.x121.setup.xea.mq5 @@ -4999,16 +4999,32 @@ private: // // Implement Other Senarios ... - // // - // double equity = mTrader.mAccount.GetEquity(); - // double balance = mTrader.mAccount.GetBalance(); - // double forceCloseOnEuityDiff = ForceCloseOnEuityDiff(); - - // // - // bool canForceClose = - // forceCloseOnEuityDiff <= 0 - // ? false - // : balance > + // + bool isMarginPassed = IsMarginPassed(); + bool isMaxNumberPassed = IsNumberOfPositionsPassed(); + bool canProtect = !isMarginPassed || !isMaxNumberPassed; + if (canProtect) + { + // + int maxInDIDX = FindMaxDrawdownIndex( + positions // + ); + if (IsValidIndex(maxInDIDX)) + { + // + 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 79179e99..a22edfd7 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 = true; // Enable Trailling Stop Losses +input bool x121EAAllowTrailStop = false; // 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