This commit is contained in:
2024-09-26 02:58:33 +03:30
parent 40c5118f2c
commit ebd2e20f4a
@@ -1194,6 +1194,71 @@ class X121SCTradeHandler : public XSCBaseAlert
// //
// In Drawdown Positions Protecting ... // In Drawdown Positions Protecting ...
//
// Protect ...
//
bool AllowProtect()
{
return mAllowProtect;
}
//
void AllowProtect(bool value)
{
mAllowProtect = value;
}
//
double ProtectionStartDistance()
{
return mProtectionStartDistance;
}
//
void ProtectionStartDistance(double value)
{
//
if (value < 0)
{
value = 0;
}
//
mProtectionStartDistance = value;
}
//
double ProtectionVolumeMultiplier()
{
return mProtectionVolumeMultiplier;
}
//
void ProtectionVolumeMultiplier(double value)
{
//
if (value < 0)
{
value = 0;
}
//
mProtectionVolumeMultiplier = value;
}
//
bool ProtectOnConditions()
{
return mProtectOnConditions;
}
//
void ProtectOnConditions(bool value)
{
mProtectOnConditions = value;
}
// // // //
// // Freeze ... // // Freeze ...
// bool AllowFreeze() // bool AllowFreeze()
@@ -1369,7 +1434,8 @@ class X121SCTradeHandler : public XSCBaseAlert
// Partial Close (In Drawdown) ... // Partial Close (In Drawdown) ...
// //
double PartialCloseInDrawdownDistance() double
PartialCloseInDrawdownDistance()
{ {
return mPartialCloseInDrawdownDistance; return mPartialCloseInDrawdownDistance;
} }
@@ -2648,6 +2714,20 @@ class X121SCTradeHandler : public XSCBaseAlert
// //
// Reading Requirement for Freezing Positions ... // Reading Requirement for Freezing Positions ...
//
// Protect ...
bool allowProtect = AllowProtect();
bool protectOnConditions = ProtectOnConditions();
double protectDistance = ProtectionStartDistance();
double protectVolumeMultiplier = ProtectionVolumeMultiplier();
bool canProtect =
!isInProfit &&
allowProtect &&
supportsCount == 0 &&
protectDistance > 0 &&
protectVolumeMultiplier > 0 &&
MathAbs(profitInPoint) >= Mathbs(protectDistance);
// //
// bool allowFreeze = AllowFreeze(); // bool allowFreeze = AllowFreeze();
// double freezeDistance = FreezeDistance(); // double freezeDistance = FreezeDistance();
@@ -2692,6 +2772,7 @@ class X121SCTradeHandler : public XSCBaseAlert
result = result =
canTrail || canTrail ||
canFreeze || canFreeze ||
canProtect ||
canSupport || canSupport ||
canPartialClose; canPartialClose;
if (!result) if (!result)
@@ -3189,11 +3270,30 @@ class X121SCTradeHandler : public XSCBaseAlert
// } // }
// } // }
//
// Protect ...
bool isProtected = false;
if (canProtected)
{
//
bool hasLongProtectConditions = isTicksBullishForLong &&
hasBullishConditions;
bool hasShortProtectConditions = isTicksBearishForShort &&
hasBearishConditions;
bool hasProtectConditions = hasLongProtectConditions ||
hasShortProtectConditions;
if (hasSupportConditions) {
//
}
}
// //
result = result =
isTrailed || isTrailed ||
isFreezed || isFreezed ||
isSupported || isSupported ||
isProtected ||
isPartialClosed; isPartialClosed;
// //
@@ -3248,6 +3348,13 @@ class X121SCTradeHandler : public XSCBaseAlert
// //
// In Drawdown Positions Protecting ... // In Drawdown Positions Protecting ...
//
// Protect ...
bool mAllowProtect; // Allow Proptecting
double mProtectionStartDistance; // Protection Start Drawdown in Profit
double mProtectionVolumeMultiplier; // Protection Volume Multiplier
bool mProtectOnConditions; // Do Protection only when Conditions happens
// //
// Freeze ... // Freeze ...
// bool mAllowFreeze; // Allow Freezing // bool mAllowFreeze; // Allow Freezing