VPS: EA not working properly with VPS

 

My EA halts trading during specific times. This function works perfectly when running from my local machine. Once I started running on VPS it stopped working.


For example..it should halt trading between 00:00 and 13:45, but it was still being halted after 14:00. See the log below. The code uses TimeCurrent function to specify the time. Is the server time for the VPS different? If so, it would have been nice for MT5 to make this clear. Very frustrating.



 
Christopher M A Holmes:

Hi Christopher,

please show the code (using the 'Code' button or Alt+S) so that we can help you determine what may be wrong.

If you use TimeCurrent() the VPS server time cannot be the cause of the problem, since as the documentation itself says "Returns the last known server time" and not the system time (TimeLocal()).

 
Christopher M A Holmes:

My EA halts trading during specific times. This function works perfectly when running from my local machine. Once I started running on VPS it stopped working.


For example..it should halt trading between 00:00 and 13:45, but it was still being halted after 14:00. See the log below. The code uses TimeCurrent function to specify the time. Is the server time for the VPS different? If so, it would have been nice for MT5 to make this clear. Very frustrating.



Why are you thinking it was "still being halted after 14:00", if 14:00 is the broker server time you can't deduct than from what you posted. The time on the left of each line of the log is the local time.
 
Christopher M A Holmes #I resolved this, thanks. The time shown in the VPS journal is different, but the code actually runs on the proper times.

Perfect. I'm glad everything is ok. ;-)

Reason: