I do understand the seconds minutes etc etc but just can not figure out how to use it
static datetime resumeTime=0; : #define HR2400 86400 // 24*60*60=PeriodSeconds(PERIOD_D1) datetime now = TimeCurrent(); if(now < resumeTime) return; : if(condition) resumeTime = now + HR2400;
ok thanks very much so far for that. understand more now but that does not look like it will work at week ends. If my EA is stopped at close on a Friday it will start again as soon as the market opens again so there will be no 24hr break in activity. Or I am I wrong?
That is correct, if your broker's TZ does not have a small Saturday or tomorrow is a market holiday or the weekend. You said "stops after 24hrs," not skip a trading day. Those are different.
static datetime skipDate=0; : // Update D1 chart. ResetLastError(); datetype yesterday = iTime(_Symbol, PERIOD_D1, 1); if(_LastError != 0) return; // No D1 if(yesterday == skipDate) return; : if(condition) skipDate = date();Find bar of the same time one day ago - Simple Trading Strategies - MQL4 and MetaTrader 4 - MQL4 programming forum
Migrating from MQL4 to MQL5 - MQL5 Articles № 18
That is correct, if your broker's TZ does not have a small Saturday or tomorrow is a market holiday or the weekend. You said "stops after 24hrs," not skip a trading day. Those are different.
Migrating from MQL4 to MQL5 - MQL5 Articles № 18
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Have been looking at date and time functions and admit that being 68 years old doesn't help. All i want to do is be able to stop my EA from trading for 24 business hours when things are going against me and then let the EA continue from where it stops after 24hrs have passed (at the end of the 24 hour delay) it should then continue from where it left off. Just don't understand properly how to use date & time - can't get my head round the date time stuff!
HELP please.