TimeTradeServer

 
How to get similar result to TimeTradeServer in mql4? I need handle day changes but without using TimeCurrent or the time of bar opening I would like to know the server time if possible.
 
Samuel Manoel De Souza: I need handle day changes but without using TimeCurrent or the time of bar opening I would like to know the server time if possible.
  1. TimeCurrent is the last known server time.

  2. Why do you not want bar opening? Explain yourself.

  3. void OnTick(){
       static datetime dateCurr=0; datetime datePrev=dateCurr; dateCurr=date();
       if( dateCurr != datePrev ) OnNewDay();
              date/time (2017)
              Find bar of the same time one day ago - MQL4 programming forum (2017)

 
As far as I am aware, there is no such function available in MT4. You will need to synthesize that from TimeCurrent and TimeLocal in order to get what you want. It will have an issue though. If markets are closed, you don't get current market times and I haven't found a link between market time and local time from which you could derive the difference between the two.
Reason: