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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user