This commit is contained in:
2024-09-20 18:17:31 +03:30
parent 46f8009ca5
commit ba1c5a73b7
2 changed files with 67 additions and 10 deletions
@@ -1237,6 +1237,18 @@ class X121SCTradeHandler : public XSCBaseAlert
mRecoveryMultiplier = value; mRecoveryMultiplier = value;
} }
//
bool ApplyRecoveryLevelOnVolume()
{
return mApplyRecoveryLevelOnVolume;
}
//
void ApplyRecoveryLevelOnVolume(bool value)
{
mApplyRecoveryLevelOnVolume = value;
}
// //
int RecoveryDelayInMinute() int RecoveryDelayInMinute()
{ {
@@ -2819,9 +2831,14 @@ class X121SCTradeHandler : public XSCBaseAlert
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET; ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
double lastStep = mData[iDX].protectionStep; double lastStep = mData[iDX].protectionStep;
double volume = position.volume * volumeMultiplier; double volume = position.volume * volumeMultiplier;
// supportsCount <= 0 bool applyLevel = ApplyRecoveryLevelOnVolume();
// ? position.volume * volumeMultiplier if (applyLevel)
// : position.volume * ((supportsCount + 1) * volumeMultiplier); {
//
volume = supportsCount <= 0
? position.volume *volumeMultiplier
: position.volume *((supportsCount + 1) * volumeMultiplier);
}
// //
datetime currentTime = TimeCurrent(); datetime currentTime = TimeCurrent();
@@ -2850,7 +2867,15 @@ class X121SCTradeHandler : public XSCBaseAlert
{ {
// //
// Same Direction ... // Same Direction ...
canRecover = true; canRecover =
//
isTicksBullishForLong &&
hasBullishTrend &&
(hasBullishPower ||
hasBullishPattern ||
hasBullishPressure)
//
;
if (canRecover) if (canRecover)
{ {
// //
@@ -2865,7 +2890,15 @@ class X121SCTradeHandler : public XSCBaseAlert
{ {
// //
// Same Direction ... // Same Direction ...
canRecover = true; canRecover =
//
isTicksBearishForShort &&
hasBearishTrend &&
(hasBearishPower ||
hasBearishPattern ||
hasBearishPressure)
//
;
if (canRecover) if (canRecover)
{ {
// //
@@ -2994,9 +3027,14 @@ class X121SCTradeHandler : public XSCBaseAlert
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET; ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
double lastStep = mData[iDX].protectionStep; double lastStep = mData[iDX].protectionStep;
double volume = position.volume * volumeMultiplier; double volume = position.volume * volumeMultiplier;
// supportsCount <= 0 bool applyLevel = ApplyRecoveryLevelOnVolume();
// ? position.volume * volumeMultiplier if (applyLevel)
// : position.volume * ((supportsCount + 1) * volumeMultiplier); {
//
volume = supportsCount <= 0
? position.volume *volumeMultiplier
: position.volume *((supportsCount + 1) * volumeMultiplier);
}
// //
datetime currentTime = TimeCurrent(); datetime currentTime = TimeCurrent();
@@ -3028,7 +3066,15 @@ class X121SCTradeHandler : public XSCBaseAlert
{ {
// //
// Opposit Direction ... // Opposit Direction ...
canRecover = true; canRecover =
//
isTicksBearishForShort &&
hasBearishTrend &&
(hasBearishPower ||
hasBearishPattern ||
hasBearishPressure)
//
;
if (canRecover) if (canRecover)
{ {
// //
@@ -3043,7 +3089,15 @@ class X121SCTradeHandler : public XSCBaseAlert
{ {
// //
// Opposit Direction ... // Opposit Direction ...
canRecover = true; canRecover =
//
isTicksBullishForLong &&
hasBullishTrend &&
(hasBullishPower ||
hasBullishPattern ||
hasBullishPressure)
//
;
if (canRecover) if (canRecover)
{ {
// //
@@ -3192,6 +3246,7 @@ class X121SCTradeHandler : public XSCBaseAlert
// In Drawdown Positions Protecting ... // In Drawdown Positions Protecting ...
bool mAllowRecoverInDrawdowns; // Allow Recovery For In Drawdown Positions bool mAllowRecoverInDrawdowns; // Allow Recovery For In Drawdown Positions
double mRecoveryMultiplier; // Recovery Volume Multiplier double mRecoveryMultiplier; // Recovery Volume Multiplier
bool mApplyRecoveryLevelOnVolume; // Apply Recovery Level on Volume Calculation
int mRecoveryDelayInMinute; // Delay Between Two Recovery in Minutes int mRecoveryDelayInMinute; // Delay Between Two Recovery in Minutes
double mRecoveryDistanceInPoint; // Distance Between Two Recovery in Point double mRecoveryDistanceInPoint; // Distance Between Two Recovery in Point
double mPartialCloseOnSpecificPointOfDrawdown; // Partial Close Position on Specific Points of Drawdown double mPartialCloseOnSpecificPointOfDrawdown; // Partial Close Position on Specific Points of Drawdown
+2
View File
@@ -112,6 +112,7 @@ input double eaPartialCloseVolumeInProfit = 0; // Partial Close Volume
input group "In Drawdown Positions Protecting"; input group "In Drawdown Positions Protecting";
input bool eaAllowRecoverInDrawdowns = true; // Allow Recovery For In Drawdown Positions input bool eaAllowRecoverInDrawdowns = true; // Allow Recovery For In Drawdown Positions
input double eaRecoveryMultiplier = 1; // Recovery Volume Multiplier input double eaRecoveryMultiplier = 1; // Recovery Volume Multiplier
input bool eaApplyRecoveryLevelOnVolume = true; // Apply Recovery Level on Volume Calculation
input int eaRecoveryDelayInMinute = 1; // Delay Between Two Recovery in Minutes input int eaRecoveryDelayInMinute = 1; // Delay Between Two Recovery in Minutes
input double eaRecoveryDistanceInPoint = 30; // Distance Between Two Recovery in Point input double eaRecoveryDistanceInPoint = 30; // Distance Between Two Recovery in Point
input double eaPartialCloseOnSpecificPointOfDrawdown = 0; // Partial Close Position on Specific Points of Drawdown input double eaPartialCloseOnSpecificPointOfDrawdown = 0; // Partial Close Position on Specific Points of Drawdown
@@ -501,6 +502,7 @@ bool InitialEA()
// Protector > In Drawdown Positions Protecting ... // Protector > In Drawdown Positions Protecting ...
eaTradeHandler.AllowRecoverInDrawdowns(eaAllowRecoverInDrawdowns); eaTradeHandler.AllowRecoverInDrawdowns(eaAllowRecoverInDrawdowns);
eaTradeHandler.RecoveryMultiplier(eaRecoveryMultiplier); eaTradeHandler.RecoveryMultiplier(eaRecoveryMultiplier);
eaTradeHandler.ApplyRecoveryLevelOnVolume(eaApplyRecoveryLevelOnVolume);
eaTradeHandler.RecoveryDelayInMinute(eaRecoveryDelayInMinute); eaTradeHandler.RecoveryDelayInMinute(eaRecoveryDelayInMinute);
eaTradeHandler.RecoveryDistanceInPoint(eaRecoveryDistanceInPoint); eaTradeHandler.RecoveryDistanceInPoint(eaRecoveryDistanceInPoint);
eaTradeHandler.PartialCloseOnSpecificPointOfDrawdown(eaPartialCloseOnSpecificPointOfDrawdown); eaTradeHandler.PartialCloseOnSpecificPointOfDrawdown(eaPartialCloseOnSpecificPointOfDrawdown);