Last ...
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user