Can someone please explain to me why there is an addition of one in this line of the code 'One_Farm=One_Farm*(1+Perc_day/100)' and a subtraction of 1 in this one 'One_Farm=One_Farm*(1-Perc_exit/100);'
intstart()// Special function start(){//-------------------------------------------------------------------------------------intday, // Current day of the monthMons; // Search amount of monthsdoubleOne_Farm =1000.0, // Sheep on the 1st farmPerc_day =1, // Daily increase, in %One_Farm_max=50000.0, // Sheep limitPerc_exit =10, // Monthly output, in %Purpose =35000.0, // Required amount on farm 2Two_Farm; // Current amount of farm 2//-------------------------------------------------------------------------------------while(Two_Farm < Purpose)// External cycle on history{// Start of the external cycle body//-------------------------------------------------------------------------------for(day=1; day<=30; day++)// Cycle for days of monthOne_Farm=One_Farm*(1+Perc_day/100);//Accumulation on the 1st farm//-------------------------------------------------------------------------------Mons++; // Count monthsif(One_Farm < One_Farm_max)// If the amount is below limit,.continue; // .. don't transfer the sheepTwo_Farm=Two_Farm+One_Farm*Perc_exit/100;//Sheep on the 2nd farmOne_Farm=One_Farm*(1-Perc_exit/100);// Remainder on the 1st farm}// End of the external cycle body//-------------------------------------------------------------------------------------Alert("The aim will be attained within ",Mons," months.");//Display on the screenreturn; // Exit function start()}//-------------------------------------------------------------------------------------
I got this code from the mql4 programming book.