diff --git a/Experts/Nkanven/Framework EA/Grid/GridEA.ex5 b/Experts/Nkanven/Framework EA/Grid/GridEA.ex5 index ee02be7..2a68cd7 100644 Binary files a/Experts/Nkanven/Framework EA/Grid/GridEA.ex5 and b/Experts/Nkanven/Framework EA/Grid/GridEA.ex5 differ diff --git a/Experts/Nkanven/Framework EA/Grid/GridEA.mq5 b/Experts/Nkanven/Framework EA/Grid/GridEA.mq5 index 6b694e1..df7cf47 100644 --- a/Experts/Nkanven/Framework EA/Grid/GridEA.mq5 +++ b/Experts/Nkanven/Framework EA/Grid/GridEA.mq5 @@ -23,6 +23,7 @@ input ENUM_RISK_DEFAULT_SIZE InpRiskDefaultSize=RISK_DEFAULT_AUTO; //Positi input double InpDefaultLotSize=1; //Position Size (if fixed or if no stop loss defined) input ENUM_RISK_BASE InpRiskBase=RISK_BASE_BALANCE; //Risk Base input double InpMaxRiskPerTrade=0.5; //Percentage To Risk Each Trade +input double InpProfitPercent=1; input double InpMinLotSize=0.01; //Min Lot Size input double InpMaxLotSize=100; //Max Lot Size diff --git a/Include/Nkanven/Frameworks/GridEA/ExpertBase.mqh b/Include/Nkanven/Frameworks/GridEA/ExpertBase.mqh index 9b73772..e1c0ec2 100644 --- a/Include/Nkanven/Frameworks/GridEA/ExpertBase.mqh +++ b/Include/Nkanven/Frameworks/GridEA/ExpertBase.mqh @@ -31,6 +31,7 @@ protected: double mMaxLotSize; double mMinLotSize; double mMaxRiskPerTrade; + double mProfitPercent; double lastBuyOrderPrice; @@ -147,6 +148,7 @@ public: // Default properties virtual void SetMaxLotSize(double maxLotSize) {mMaxLotSize = maxLotSize;} virtual void SetMinLotSize(double minLotSize) {mMinLotSize = minLotSize;} virtual void SetMaxRiskPerTrade(double maxRiskPerTrade) {mMaxRiskPerTrade = maxRiskPerTrade;} + virtual void SetProfitPercent(double profitPercent) {mProfitPercent = profitPercent;} virtual void SetUseTradingSession(ENUM_TRADING_SESSION useTradingSession) {mUseTradingSession = useTradingSession;} @@ -733,7 +735,7 @@ void CExpertBase::TradeWatcher(void) double floatingProfitPercent = ((AccountInfoDouble(ACCOUNT_EQUITY) - AccountInfoDouble(ACCOUNT_BALANCE))*100)/AccountInfoDouble(ACCOUNT_BALANCE); // Check if profit is at least the mMaxRiskPerTrade - Print(" MaxRiskPerTrade ",mMaxRiskPerTrade, " Floating profit percent ", floatingProfitPercent, " Account equity ", AccountInfoDouble(ACCOUNT_EQUITY), " Account balance ", AccountInfoDouble(ACCOUNT_BALANCE)); + Print(" Profit Percent ",InpProfitPercent, " Floating profit percent ", floatingProfitPercent, " Account equity ", AccountInfoDouble(ACCOUNT_EQUITY), " Account balance ", AccountInfoDouble(ACCOUNT_BALANCE)); //The number of buy pending order should be twice the opened sell positions; and vice versa realOCountBuy = pCountSell+1; @@ -776,7 +778,7 @@ void CExpertBase::TradeWatcher(void) { //When there are multiple positions, check is the account is making enough profit Print("floatingProfitPercent ", floatingProfitPercent, " mMaxRiskPerTrade ", mMaxRiskPerTrade); - if(floatingProfitPercent > mMaxRiskPerTrade) + if(floatingProfitPercent > mProfitPercent) { exitSignal = OFX_SIGNAL_ALL; Print("Exit on profit target");