diff --git a/Classes/x-saherelm.x121.xtrade.handler.class.mq5 b/Classes/x-saherelm.x121.xtrade.handler.class.mq5 index 6ac00396..98b8d0d1 100644 --- a/Classes/x-saherelm.x121.xtrade.handler.class.mq5 +++ b/Classes/x-saherelm.x121.xtrade.handler.class.mq5 @@ -22,6 +22,7 @@ // // Imports ... #include "../Classes/x-saherelm.xtrade.class.mq5" +#include "../Helpers/x-saherelm.xchvwap.helper.mq5" // // Definitions ... @@ -1284,6 +1285,25 @@ class X121SCTradeHandler : public XSCBaseAlert mSupportStartDistance = value; } + // + int MaxAllowedSupport() + { + return mMaxAllowedSupport; + } + + // + void MaxAllowedSupport(int value) + { + // + if (value < 0) + { + value = 0; + } + + // + mMaxAllowedSupport = value; + } + // double SupportVolumeMultiplier() { @@ -2640,16 +2660,24 @@ class X121SCTradeHandler : public XSCBaseAlert // Reading Requirement for Support Positions ... bool allowSupport = AllowSupport(); double supportStartDistance = SupportStartDistance(); + int maxAllowedSupport = MaxAllowedSupport(); int delayBetweenTwoSupport = DelayBetweenTwoSupport(); double supportVolumeMultiplier = SupportVolumeMultiplier(); bool multiplySupportLevelOnVolume = MultiplySupportLevelOnVolume(); bool doSupportOnConditions = DoSupportOnConditions(); - bool canSupport = (!isInProfit || + bool canSupport = allowSupport && + (!isInProfit || (isInProfit && supportsCount > 0)) && + maxAllowedSupport >= 0 && supportStartDistance >= 0 && supportVolumeMultiplier > 0 && MathAbs(profitInPoint) >= supportStartDistance && // + // Check Max Allowed Support ... + (maxAllowedSupport == 0 + ? true + : supportsCount < maxAllowedSupport) && + // // Check Delay ... (!IsValid(mData[iDX].lastSupportedOn) ? true @@ -3226,6 +3254,7 @@ class X121SCTradeHandler : public XSCBaseAlert // Support ... bool mAllowSupport; // Allow Support double mSupportStartDistance; // Specify Start Support Drawdown in Point + int mMaxAllowedSupport; // Max Allowed Number of Support Position double mSupportVolumeMultiplier; // Specify Support Volume Multiplier bool mMultiplySupportLevelOnVolume; // Multiply Support Level on Volume Multiplier bool mDoSupportOnConditions; // Do Support on Conditions @@ -3452,6 +3481,13 @@ class X121SCTradeHandler : public XSCBaseAlert mCollector.SaveSignal(item); } + // + // Install all Helpers and Prepare all + // Configurations for required Indicators ... + void PrepareRequirements() + { + } + // }; diff --git a/Experts/x-saherelm.x121.ea.mq5 b/Experts/x-saherelm.x121.ea.mq5 index 42b2180d..a6e99bc2 100644 --- a/Experts/x-saherelm.x121.ea.mq5 +++ b/Experts/x-saherelm.x121.ea.mq5 @@ -85,7 +85,7 @@ input double eaMaxDrawdownPercentForOpenTrades = 3; // Max Drawdown Percent for // // Protector ... input group "Protector"; -input int eaDelayBarBetweenTwoSameSignal = 5; // Delay Bars Between Two Same Type Signal +input int eaDelayBarBetweenTwoSameSignal = 5; // Delay Bars Between Two Same Type Signal // // Protector > Hedging Properties ... @@ -131,6 +131,7 @@ input bool eaDisableTrailWhenFreezedPosition = true; // Disable Trail when has F input group "Support"; input bool eaAllowSupport = false; // Allow Support input double eaSupportStartDistance = 0; // Specify Start Support Drawdown in Point +input int eaMaxAllowedSupport = 2; // Max Allowed Number of Support Position input double eaSupportVolumeMultiplier = 1; // Specify Support Volume Multiplier input bool eaMultiplySupportLevelOnVolume = false; // Multiply Support Level on Volume Multiplier input bool eaDoSupportOnConditions = true; // Do Support on Conditions @@ -541,6 +542,7 @@ bool InitialEA() // Support ... eaTradeHandler.AllowSupport(eaAllowSupport); eaTradeHandler.SupportStartDistance(eaSupportStartDistance); + eaTradeHandler.MaxAllowedSupport(eaMaxAllowedSupport); eaTradeHandler.SupportVolumeMultiplier(eaSupportVolumeMultiplier); eaTradeHandler.MultiplySupportLevelOnVolume(eaMultiplySupportLevelOnVolume); eaTradeHandler.DoSupportOnConditions(eaDoSupportOnConditions);