diff --git a/Experts/Nkanven/TheChallenger.ex5 b/Experts/Nkanven/TheChallenger.ex5 index a87db0f..0378654 100644 Binary files a/Experts/Nkanven/TheChallenger.ex5 and b/Experts/Nkanven/TheChallenger.ex5 differ diff --git a/Experts/Nkanven/TheChallenger.mq5 b/Experts/Nkanven/TheChallenger.mq5 index e55f3ba..0746abe 100644 --- a/Experts/Nkanven/TheChallenger.mq5 +++ b/Experts/Nkanven/TheChallenger.mq5 @@ -19,10 +19,7 @@ //| Expert initialization function | //+------------------------------------------------------------------+ -#include #include -CiMA* ma; -CiMA* maHT; CiATR* atr; //+------------------------------------------------------------------+ @@ -31,12 +28,6 @@ CiATR* atr; int OnInit() { //--- - ma = new CiMA(); - ma.Create(gSymbol, InpTimeFrame, InpPeriods, InpAppliedPrice, InpMethod, PRICE_CLOSE); - - maHT = new CiMA(); - maHT.Create(gSymbol, InpHtTimeframe, InpHtPeriods, InpHtAppliedPrice, InpHtMethod, PRICE_CLOSE); - atr = new CiATR(); atr.Create(gSymbol, InpTimeFrame, InpAtrPeriod); //--- @@ -63,31 +54,19 @@ void OnTick() CheckOperationHours(); CheckPreChecks(); ScanPositions(); -//Get technical indicators values - ma.Refresh(-1); - gMa = ma.Main(1); + //Get ATR values atr.Refresh(-1); gAtr = atr.Main(1); - maHT.Refresh(-1); - gHtMa = maHT.Main(1); - - Print("ATR ", gAtr); - Comment("gHtMa ", gHtMa); - if(!gIsPreChecksOk) return; - Print("Good for trading..."); - if(InpActivateRiskWatcher) { drawdownWatcher(); CloseTransactions(); } - - getSignal(); ExecuteEntry(); } //+------------------------------------------------------------------+ diff --git a/Include/Nkanven/TheChallenger/EntriesManager.mqh b/Include/Nkanven/TheChallenger/EntriesManager.mqh index e70d3f7..0651068 100644 Binary files a/Include/Nkanven/TheChallenger/EntriesManager.mqh and b/Include/Nkanven/TheChallenger/EntriesManager.mqh differ diff --git a/Include/Nkanven/TheChallenger/LotSizeCal.mqh b/Include/Nkanven/TheChallenger/LotSizeCal.mqh index 6b0afde..7bf44fc 100644 --- a/Include/Nkanven/TheChallenger/LotSizeCal.mqh +++ b/Include/Nkanven/TheChallenger/LotSizeCal.mqh @@ -18,7 +18,7 @@ void LotSizeCalculate(double SL=0) { double RiskBaseAmount=0; Print("Compute lot size"); - + //TickValue is the value of the individual price increment for 1 lot of the instrument, expressed in the account currenty double TickValue=SymbolInfoDouble(gSymbol,SYMBOL_TRADE_TICK_VALUE); //Define the base for the risk calculation depending on the parameter chosen @@ -31,31 +31,32 @@ void LotSizeCalculate(double SL=0) //Calculate the Position Size gLotSize=((RiskBaseAmount*InpMaxRiskPerTrade/100)/(SL*TickValue)); - + Print("(RiskBaseAmount ", RiskBaseAmount, " InpMaxRiskPerTrade ", InpMaxRiskPerTrade, " SL ", SL, " TickValue ", TickValue); } //If the stop loss is zero then the lot size is the default one - /*if(SL==0) + if(SL==0) { gLotSize=InpDefaultLotSize; - }*/ + } } //Normalize the Lot Size to satisfy the allowed lot increment and minimum and maximum position size gLotSize=MathFloor(gLotSize/SymbolInfoDouble(gSymbol,SYMBOL_VOLUME_STEP))*SymbolInfoDouble(gSymbol,SYMBOL_VOLUME_STEP); -Print("LotSize ", gLotSize); + Print("LotSize ", gLotSize); //Limit the lot size in case it is greater than the maximum allowed by the broker if(gLotSize>SymbolInfoDouble(gSymbol,SYMBOL_VOLUME_MAX)) gLotSize=SymbolInfoDouble(gSymbol,SYMBOL_VOLUME_MAX); - Print("Lot ", gLotSize, " Max lot ", SymbolInfoDouble(gSymbol,SYMBOL_VOLUME_MAX)); + Print("Lot ", gLotSize, " Max lot ", SymbolInfoDouble(gSymbol,SYMBOL_VOLUME_MAX)); -Print("LotSize2 ", gLotSize); + Print("LotSize2 ", gLotSize); //If the lot size is too small then set it to 0 and don't trade - if(gLotSize