This commit is contained in:
2024-06-24 10:30:19 +03:30
parent 4854b9f6a8
commit 56335244a3
2 changed files with 27 additions and 11 deletions
+26 -10
View File
@@ -4999,16 +4999,32 @@ private:
// //
// Implement Other Senarios ... // Implement Other Senarios ...
// // //
// double equity = mTrader.mAccount.GetEquity(); bool isMarginPassed = IsMarginPassed();
// double balance = mTrader.mAccount.GetBalance(); bool isMaxNumberPassed = IsNumberOfPositionsPassed();
// double forceCloseOnEuityDiff = ForceCloseOnEuityDiff(); bool canProtect = !isMarginPassed || !isMaxNumberPassed;
if (canProtect)
// // {
// bool canForceClose = //
// forceCloseOnEuityDiff <= 0 int maxInDIDX = FindMaxDrawdownIndex(
// ? false positions //
// : balance > );
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);
}
}
}
// //
} }
+1 -1
View File
@@ -74,7 +74,7 @@ input bool x121EACloseOnOpposit = false; // Close all Positions on Opposit
// //
input group "Trailling"; 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 bool x121EADisableTrailingWhenOpposit = true; // Disable Trailling When has Opposite In Drawdown
input double x121EAFirstTrailDistance = 100; // Start Trailling Distance input double x121EAFirstTrailDistance = 100; // Start Trailling Distance
input double x121EAFirstTrailPoint = 60; // First Stop Trail input double x121EAFirstTrailPoint = 60; // First Stop Trail