Both of them returns the computer time, isn't it?
What is the difference between them?
My computer time and the time on the market watch are both 22:49 now ... and for experiencing with the TimeTradeServer, I changed my computer time temporarily to 23:49.
TimeTradeServer now returns 23:49 ... equal to my computer time even though the time on the market watch is still 22:49.
So, I think that TimeTradeServer always shows the computer time ... and so it always returns the same time with TimeLocal ... am I wrong?
TimeLocal() will returns the local time of a computer, where the client
terminal is running.
TimeTradeServer() will returns the calculated current time of the trade server ( your broker server time )
Trying to get a handle on the purpose of TimeTradeServer().
In my test:
Print(StringFormat("diff [%d]", TimeCurrent() - TimeTradeServer()));
Print(StringFormat("diff [%d]", TimeLocal() - TimeTradeServer()));
I get the following results:
2018.05.16 14:15:51.865 Quick (EURUSD,M30) diff 
2018.05.16 14:15:51.865 Quick (EURUSD,M30) diff [-36000]
 seconds is 10 hours. Thus TimeTradeServer() tracks the same minutes and seconds as my desktop computer, but changes the hour so that it seems as though I am on the server's time zone.
TimeCurrent() is the "last known server time," which comes in as the time of the last quote. So for an active market time, I could say that this value is a good approximation (with perhaps a little lag) of the server time. The  seconds (sometimes 94) difference suggests that my desktop and the server time are off by a little over a minute and a half.
So my question is: what do I use TimeTradeServer() for? Especially when it's off from tick data times by 94 or 95 seconds?
I am using it to get the server time (with an approximation of +/- 1 second) when running code in OnTimer.
For example, on some EA I have a protection code to close a position without SL/TP after a timeout (from the opening) :
datetime ts = TimeTradeServer()+timeCorrection;
datetime ot = (datetime)PositionGetInteger(POSITION_TIME);
if(tp==0.0 && sl==0.0 && ts>=ot+PROTECTION_TIMEOUT)
// run protection code
Thank you for your response.
Correcting Windows ntp time settings with faster update interval and good ping server may be helpful. By default update interval is a week, MS servers are often unreachable and Windows kernel is horrible in keeping up time.
Needed registries in Windows 8.1, probably same for other versions:
Free and reliable servers: http://support.ntp.org/bin/view/Servers/NTPPoolServers
I have confirmed that these registry settings are the same for Windows 7.
It would certainly help if I was pointing to a valid time server. :-D
Now I am only 7 to 8 seconds behind the broker server. I can live with that.
I've set mine to update on 8000 seconds from local servers at 0.bg.pool.ntp.org, haven't seen more than 2 seconds difference.
Broker's server could also be out of sync by the way, it's not always our PC's fault.