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