diff --git a/Classes/x-saherelm.x121.xtrade.handler.class.mq5 b/Classes/x-saherelm.x121.xtrade.handler.class.mq5 index 20f047e5..dab02082 100644 --- a/Classes/x-saherelm.x121.xtrade.handler.class.mq5 +++ b/Classes/x-saherelm.x121.xtrade.handler.class.mq5 @@ -1237,6 +1237,18 @@ class X121SCTradeHandler : public XSCBaseAlert mRecoveryMultiplier = value; } + // + bool ApplyRecoveryLevelOnVolume() + { + return mApplyRecoveryLevelOnVolume; + } + + // + void ApplyRecoveryLevelOnVolume(bool value) + { + mApplyRecoveryLevelOnVolume = value; + } + // int RecoveryDelayInMinute() { @@ -2819,9 +2831,14 @@ class X121SCTradeHandler : public XSCBaseAlert ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET; double lastStep = mData[iDX].protectionStep; double volume = position.volume * volumeMultiplier; - // supportsCount <= 0 - // ? position.volume * volumeMultiplier - // : position.volume * ((supportsCount + 1) * volumeMultiplier); + bool applyLevel = ApplyRecoveryLevelOnVolume(); + if (applyLevel) + { + // + volume = supportsCount <= 0 + ? position.volume *volumeMultiplier + : position.volume *((supportsCount + 1) * volumeMultiplier); + } // datetime currentTime = TimeCurrent(); @@ -2850,7 +2867,15 @@ class X121SCTradeHandler : public XSCBaseAlert { // // Same Direction ... - canRecover = true; + canRecover = + // + isTicksBullishForLong && + hasBullishTrend && + (hasBullishPower || + hasBullishPattern || + hasBullishPressure) + // + ; if (canRecover) { // @@ -2865,7 +2890,15 @@ class X121SCTradeHandler : public XSCBaseAlert { // // Same Direction ... - canRecover = true; + canRecover = + // + isTicksBearishForShort && + hasBearishTrend && + (hasBearishPower || + hasBearishPattern || + hasBearishPressure) + // + ; if (canRecover) { // @@ -2994,9 +3027,14 @@ class X121SCTradeHandler : public XSCBaseAlert ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET; double lastStep = mData[iDX].protectionStep; double volume = position.volume * volumeMultiplier; - // supportsCount <= 0 - // ? position.volume * volumeMultiplier - // : position.volume * ((supportsCount + 1) * volumeMultiplier); + bool applyLevel = ApplyRecoveryLevelOnVolume(); + if (applyLevel) + { + // + volume = supportsCount <= 0 + ? position.volume *volumeMultiplier + : position.volume *((supportsCount + 1) * volumeMultiplier); + } // datetime currentTime = TimeCurrent(); @@ -3028,7 +3066,15 @@ class X121SCTradeHandler : public XSCBaseAlert { // // Opposit Direction ... - canRecover = true; + canRecover = + // + isTicksBearishForShort && + hasBearishTrend && + (hasBearishPower || + hasBearishPattern || + hasBearishPressure) + // + ; if (canRecover) { // @@ -3043,7 +3089,15 @@ class X121SCTradeHandler : public XSCBaseAlert { // // Opposit Direction ... - canRecover = true; + canRecover = + // + isTicksBullishForLong && + hasBullishTrend && + (hasBullishPower || + hasBullishPattern || + hasBullishPressure) + // + ; if (canRecover) { // @@ -3192,6 +3246,7 @@ class X121SCTradeHandler : public XSCBaseAlert // In Drawdown Positions Protecting ... bool mAllowRecoverInDrawdowns; // Allow Recovery For In Drawdown Positions double mRecoveryMultiplier; // Recovery Volume Multiplier + bool mApplyRecoveryLevelOnVolume; // Apply Recovery Level on Volume Calculation int mRecoveryDelayInMinute; // Delay Between Two Recovery in Minutes double mRecoveryDistanceInPoint; // Distance Between Two Recovery in Point double mPartialCloseOnSpecificPointOfDrawdown; // Partial Close Position on Specific Points of Drawdown diff --git a/Experts/x-saherelm.x121.ea.mq5 b/Experts/x-saherelm.x121.ea.mq5 index 152eea44..e0ad79ae 100644 --- a/Experts/x-saherelm.x121.ea.mq5 +++ b/Experts/x-saherelm.x121.ea.mq5 @@ -112,6 +112,7 @@ input double eaPartialCloseVolumeInProfit = 0; // Partial Close Volume input group "In Drawdown Positions Protecting"; input bool eaAllowRecoverInDrawdowns = true; // Allow Recovery For In Drawdown Positions 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 double eaRecoveryDistanceInPoint = 30; // Distance Between Two Recovery in Point input double eaPartialCloseOnSpecificPointOfDrawdown = 0; // Partial Close Position on Specific Points of Drawdown @@ -501,6 +502,7 @@ bool InitialEA() // Protector > In Drawdown Positions Protecting ... eaTradeHandler.AllowRecoverInDrawdowns(eaAllowRecoverInDrawdowns); eaTradeHandler.RecoveryMultiplier(eaRecoveryMultiplier); + eaTradeHandler.ApplyRecoveryLevelOnVolume(eaApplyRecoveryLevelOnVolume); eaTradeHandler.RecoveryDelayInMinute(eaRecoveryDelayInMinute); eaTradeHandler.RecoveryDistanceInPoint(eaRecoveryDistanceInPoint); eaTradeHandler.PartialCloseOnSpecificPointOfDrawdown(eaPartialCloseOnSpecificPointOfDrawdown);