The backtest doesn't start

 

Hello guys,

 I'm building an EA based on ATR range breakout and real volume with a MA filter. In the previous version the backtest was executed normally, but then i decided to determine the position size through the 

ATR to normalize risk. This is what i did: 

 

 

input double atrSl;
double tradeVolume;


//CLASS USED TO FIND THE VOLUME'S CLOSEST HUNDREDTH (The regular lot size in the market i'm trading is 100)

double cClosestHundredth(double volume){

int hundredth = 100;
int tenth;

while((volume - hundredth) >= 100){
    hundredth = hundredth + 100;
}
tenth = volume - hundredth;

if(tenth < 50){
    hundredth = volume - tenth;
}
else if(tenth >= 50){
    hundredth = (volume - tenth) + 100;
}

return(hundredth);

}


// Formula used to calculate the lots number, atr[1] * atrSl is the atr multiple that represents the stop value.
double preVolume = (100 - 0.32) / (atr[1] * atrSl);

// Volume to trade, i assigned to it the value returned from the class created above.
tradeVolume = cClosestHundredth(preVolume);

When i take this part of the code out and set any valid value to tradeVolume, the backtest runs normally. When i  put it on the code, it's like the backtest starts but it doesn't run. I tried to assign "NormalizeDouble(cClosestHundredth(preVolume),0)" to tradeVolume, but it didn't work. I don't know what is wrong with that, if someone can help me on this, i will be really grateful!