-
void OnTick() { if(lastCheckedDayOfYear!=getDay(TimeCurrent())) { // Is it time to perform a license check? if(TimeToString(TimeCurrent(),TIME_MINUTES)==checkTime)
I assume getDay does what it implies (same as my date function below). You want a new day at 1:00. But the date changes at 00:00. You will never get both at the same time and the rest never runs.
-
There can be minutes between ticks during the Asian session, think M1 chart. What happens if there is no tick during the checkTime minute?
-
datetime nextCheck=0; int checkTime = 3600; // 01:00 void OnTick() { if(TimeCurrent() >= nextCheck) { nextCheck=Tomorrow()+checkTime;
Find bar of the same time one day ago - MQL4 programming forum #1 & #6 (2017)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi! I'm trying to figure out why this code only fires on one chart at 1AM, even though the EA is actually attached to multiple charts at the same time.
Is my assumption wrong that globally scoped variables only apply to the chart that was attached? or are they in fact shared across charts?
I'm having trouble figuring this out from the docs (https://www.mql5.com/en/docs/basis/variables/global), and can't really see if there's another way around this.
Any ideas?