Thread: Nice clocks
View Single Post
  #78 (permalink)  
Old 06-09-2008, 09:36 PM
WRR WRR is offline
Member
 
Join Date: Nov 2005
Posts: 44
WRR is on a distinguished road
Bug Fix

Quote:
Originally Posted by Linuxser View Post
Done.

I think it's working fine. Just change the number of the window where you want to drop the indicator.
Hello folks,
I found a bug in the DollyClock_Lnx indicator that I fixed. See revised indicator DollyClock_LnxV2.mq4 attached. The original looked like this:

string str_gmt;
if((brokerTime-GMT)>=0)
str_gmt="GMT+"+DoubleToStr((brokerTime-GMT)/3600,0);
else
str_gmt="GMT-"+DoubleToStr((brokerTime-GMT)/3600,0);

GMT and brokerTime are integers who's difference is not exactly divisible by 3600 seconds most of the time. This is because broker servers tend to be a couple or a few seconds slower than true time. If you divide an integer by an integer the quotient is truncated. So if the difference between broker time and GMT is 1.992 hours for a GMT +2 broker, the code above returns GMT+1. If you replace 3600 with 3600.0 the indicator returns GMT+2, since it recognizes that 3600.0 is a double data type, allowing decimal places and avoiding truncation.

WRR
Attached Images
File Type: gif dolly_test.gif (50.4 KB, 276 views)
Attached Files
File Type: mq4 DollyClock_LnxV2.mq4 (18.1 KB, 56 views)

Last edited by WRR; 06-09-2008 at 09:43 PM. Reason: Label on chart should read Broker Offset not Broker Time
Reply With Quote