Download MetaTrader 5
To add comments, please log in or register
Have you just installed MetaTrader 5? Learn it in details!
whroeder1
14217
whroeder1 2015.10.07 12:09  
wemersonrv: WHRoeder, i don't get the point with the 1800 added to the equation.
  1. How do you round a double to an int?
    int res = int(dbl + 0.5); // 0.49 + 0.50 = 0.99 -> 0
                              // 0.51 + 0.50 = 1.01 -> 1
  2. How do you round seconds to an int hours?
    int    seconds = BrokerTime - ComputerTime;
    double hours   = double(seconds) / 3600.0;
    int TimeOffset = int(hours + 0.5);
  3. How do you round a int seconds to an int hours using only integer operations?
    int seconds    = BrokerTime - ComputerTime;
    int TimeOffset = (seconds + 1800)/3600; // 0.5 * 3600 = 1800
Wemerson Guimaraes
560
Wemerson Guimaraes 2015.10.07 14:46  
Ok, thanks!
/ /12
To add comments, please log in or register