Jump to content

Code works on home PC, not working on VPS


dlewisfl

Recommended Posts

I've got a little snippet of code that works fine on my home PC at multiple brokers but fails on my forex.com VPS. External variables are defined as follows:

 

extern int GMT_StartHH = 11; // GMT Hour to start trading

extern int GMT_StartMM = 00; // GMT Minute to start trading

extern int GMT_EndHH = 02; // GMT Hour to stop trading

extern int GMT_EndMM = 00; // GMT Minute to stop trading

 

Code in the function:

 

datetime GMT_Time, TimeStart, TimeEnd;

 

GMT_Time = Time[0] - (GMT_Offset * 3600);

TimeStart = StrToTime(TimeToStr(GMT_Time, TIME_DATE) + " 00:00") + (GMT_StartHH * 3600) + (GMT_StartMM * 60);

TimeEnd = StrToTime(TimeToStr(GMT_Time, TIME_DATE) + " 00:00") + (GMT_EndHH * 3600) + (GMT_EndMM * 60);

 

The GMT_Time is calculated correctly, yet the VPS adds five hours to TimeStart and TimeEnd (Print statements show start as 16 and end as 7). Before I start pulling hair out over this, does anyone see a problem with the code or know of something on the VPS that would cause the problem? Using Build 225 of MT4 on VPS, works fine on 225 and 226 on home PC.

 

Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...