MQL5: Round price to nearest integer

 double RoundPrice(double price, double roundTo)

  {

   double remainder = fmod(price, roundTo);

   double roundedPrice = price - remainder;

   if(remainder >= roundTo / 2)

      roundedPrice += roundTo;


   return roundedPrice;

  }

Comments

Popular posts from this blog

MQL5 : Add time to current time in mins

MQL5: Closed order detail