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 ...
// //
// 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);
}
}
}
//
}