diff --git a/Experts/x-saherelm.xch.strategy.ea.mq5 b/Experts/x-saherelm.xch.strategy.ea.mq5 index 76276867..f3c2f275 100644 --- a/Experts/x-saherelm.xch.strategy.ea.mq5 +++ b/Experts/x-saherelm.xch.strategy.ea.mq5 @@ -125,9 +125,6 @@ input bool eaAlertNewHours = false; // Alert New Hours // // Variables ... -// -// int mNumberOfSLs = 0; - // // Bar Style nad Time Instances ... XSCXCTHelper *mCTHelper; @@ -262,12 +259,6 @@ void OnTimer() // HandleTradeState(); // HandleTimeReport(); // HandleStrategiesOnTick(); - - // // - // if (eaTimeTracker.IsNewDay()) - // { - // mNumberOfSLs = 0; - // } } // @@ -281,7 +272,164 @@ bool ValidateInputs() bool result = false; // - result = true; + string errMessage = ""; + + // + bool isCommonValid = ( + // + eaSlippage > 0 && + eaMagicNumber > 0 + // + ); + if (!isCommonValid) + { + // + errMessage += "common configurations error;" + "\n"; + } + + // + bool isSymbolsValid = ( + // + eaMultiSymbol + ? IsValid(eaSymbols) + : true + // + ); + if (!isSymbolsValid) + { + // + errMessage += "symbols configurations error;" + "\n"; + } + + // + bool isRiskRewardValid = ( + // + (eaUseFixedTPSLPoints + ? eaTPPoint > 0 || + eaSLPoint > 0 + : eaR2R > 0) && + !(eaIgnoreTP && + eaIgnoreSL) + // + ); + if (!isRiskRewardValid) + { + // + errMessage += "risk/reward configurations error;" + "\n"; + } + + // + bool isVolumeValid = ( + // + eaUseDynamicVolume + ? eaDynamicVolumeStep >= 0.01 && + eaDynamicVolumeBalanceFactor > 0 + : eaVolume >= 0.01 + // + ); + if (!isVolumeValid) + { + // + errMessage += "volume configurations error;" + "\n"; + } + + // + bool isTradeManagementValid = ( + // + !(!eaAllowLong && !eaAllowShort) && + eaMaxAllowedLongs >= 0 && + eaMaxAllowedShorts >= 0 + // + ); + if (!isTradeManagementValid) + { + // + errMessage += "trade management configurations error;" + "\n"; + } + + // + bool isHedgingValid = ( + // + eaAllowHedging + ? eaMinTradesForHedge >= 1 && + eaHedgeVolumeFactor >= 0.01 && + eaMinimumProfitPerVolumeForHedging >= 0 + : true + // + ); + if (!isHedgingValid) + { + // + errMessage += "hedging configurations error;" + "\n"; + } + + // + bool isTraillingValid = ( + // + eaAllowTrailStop + ? eaStartTrailInPoint > 0 && + eaTrailStepInPoint > 0 + : true + // + ); + if (!isTraillingValid) + { + // + errMessage += "trailling configurations error;" + "\n"; + } + + // + bool isRecoveryValid = ( + // + eaAllowRecovery + ? eaRecoveryTPPoint > 0 && + eaRecoverySLPoint > 0 && + eaMaxAllowedRecoveryTrades >= 0 && + eaRecoveryVolumeMultiplier > 0 && + eaMaxAllowedRecoveryTradesVolume >= 0 + : true + // + ); + if (!isRecoveryValid) + { + // + errMessage += "recovery configurations error;" + "\n"; + } + + // + result = + // + // Common ... + isCommonValid && + // + // Symbols ... + isSymbolsValid && + // + // Risk/Reward ... + isRiskRewardValid && + // + // Volume ... + isVolumeValid && + // + // Trade Management ... + isTradeManagementValid && + // + // Hedging ... + isHedgingValid && + // + // Trailling ... + isTraillingValid && + // + // Recovery ... + isRecoveryValid + // + ; + + // + if (!result) + { + Print("Errors: \n", errMessage); + } // return result;