New here, Need a clarification. It takes system time right? not the trading end of the day zone.
Assume Trading works in GMT, but system time is different time zone, it won't stop at wrong time?
- Dhayal Ram #:
New here, Need a clarification. It takes system time right? not the trading end of the day zone.
Assume Trading works in GMT, but system time is different time zone, it won't stop at wrong time?
TimeCurrent is chart time. There is no asumption.
-
datetime dCurrentTime = TimeCurrent(); datetime time_tradeend = StrToTime(TimeToStr(TimeCurrent(),TIME_DATE) + " " + "23:59"); return dCurrentTime>=time_tradeend;
However, unless you get a tick in the last minute of the day, the code fails.
-
Don't use strings, just do the numerical calculation.
static datetime curDate=0; datetime preDate=curDate; curDate=date(); bool isNewDay = curDate != prevDate; ⋮
Find bar of the same time one day ago - MQL4 programming forum #1 & #6 (2017)See also Dealing with Time (Part 1): The Basics - MQL5 Articles (2021.10.01)
Dealing with Time (Part 2): The Functions - MQL5 Articles (2021.10.08)
MQL5 Programming Basics: Time - MQL5 Articles (2013.04.26)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check trading day end is reached:
This script will detect an end-of-trading day and notify
Author: Biswarup Banerjee