I need to calculate the time that is left for the Rollover starting at 22:00 GMT...
I can certainly find the current (local) time:
datetime TimeNow = TimeLocal();
But I have no clue how to proceed from here on...
The time difference between local time and GMT time is +3 hour (adding to GMT 3hours)
compare your broker time with GMT time.countdown the difference.
But how to make a subtraction with datetime variables?
Could you provide me an example please?
You should do your home work.
In MQL5 :
MqlDateTime timerollover; // <--- time struct creation
TimeGMT(timerollover); // <--- set it to current day, current yr, current mon etc ... at once
timerollover.hour=22; timerollover.min=0; timerollover.sec = 0; // <---- override just hour, mn, seconds to set it to 22h
printf("**** Remaining time until next rollover : %s",TimeToString(StructToTime(timerollover)-TimeGMT(),TIME_MINUTES|TIME_SECONDS)); // <--- substract after conversion
2018.05.30 21:58:23.089 2018.01.02 13:24:30 **** Remaining time until next rollover : 08:35:30 // <--- it's a string
Check : 13h + 8h = 21h / 35m+24m = 59 m / 30s + 30s = 1m aka 21h + 59m + 1m = 22h.
Thank you Mr. Aidibe
that was really helpful