How to check TimeMinute(Time[0]) = 30 at TF-H4 ? - page 2 12 New comment Hongliang Liu 2014.07.11 01:22 #11 when i want to send report for each hour,i do like this:reporthour:record which hour has been sent,to avoid send again.if you want to handle at 01:31,07:31...just use (31 == TimeMinute(nowtime)) instead. datetime nowtime = TimeCurrent(); //send hour report if((reporthour != TimeHour(nowtime)) && (0 == TimeMinute(nowtime)) && (OrdersTotal() > 0))//do something { } I want to report Martingale EA Experiments with MetaTrader 5 William Roeder 2014.07.11 13:17 #12 Moggy: i want to send report for each hour,i do like this: datetime nowtime = TimeCurrent(); //send hour report if((reporthour != TimeHour(nowtime)) && (0 == TimeMinute(nowtime)) && (OrdersTotal() > 0))//do somethingAnd if there is no tick at the top of the hour during the first minute, your code fails. It also fails over the weekend.Just typed. Not compiled.bool isReportTime(){ static datetime nextReportTime; datetime now = TimeCurrent(); bool isNow = now >= nextReportTime; if(isNow){ nextReportTime = now + 3600; // Next hour nextReportTime -= nextReportTime % 3600; // Top of the hour return isNow; } Oninit(){ isReportTime(); ... } Onstart(){ if( isReportTime() && (OrdersTotal() > 0))//do somethingJust typed. Not compiled. sorasit 2014.07.12 01:11 #13 WHRoeder: sorasit46: That's real.And that is my question .When run backtest on TF-H4. How to check TimeMinute(Time[0]) = 30,31.... (Etc.) ?Then why didn't you ask that in the first place?You don't want to use Time[0] because it isn't changing for the entire H4.RTM Minute() See Alphabetic Index of MQL4 Functions (600+) - MQL4 forum Sorry ! My language very weak. But thanks for the tip. Hongliang Liu 2014.07.15 06:05 #14 WHRoeder: And if there is no tick at the top of the hour during the first minute, your code fails. It also fails over the weekend.Just typed. Not compiled.Just typed. Not compiled. thanks for your ideas~ if there is no tick at the top of the hour during the first minuteeasy to improve,just changed to 10 >= TimeMinute(nowtime),not enough? 59 >= TimeMinute(nowtime) ~~~~in fact,if the symbols has no tick in one minute,no need to run EA on it anymore~,my EA is running normally for months now.datetime nowtime = TimeCurrent(); //send hour report if((reporthour != TimeHour(nowtime)) && (10 >= TimeMinute(nowtime)) && (OrdersTotal() > 0))//do somethingIt also fails over the weekend when the market is closed in weekend,there in no tick to drive onStart() and the EA is closed.i don't think it's a problem. thanks again~ A question from a Close Value On Bar Time line William Roeder 2014.07.15 13:01 #15 Moggy:when the market is closed in weekend,there in no tick to drive onStart() and the EA is closed.i don't think it's a problem.easy to improve,just changed to 10 >= TimeMinute(nowtime),not enough? 59 >= TimeMinute(nowtime) ~~~~You missed the point. If you want to send a report at the top of the hour, it may not on market open.Market closed at 04:59 ET Friday - no report sent, not top of the hour.Market opens at 18:00 ET Sunday - no tick for the first minute, no report sent.Either you want a report sent at the top of the hour, every hour or you don't. Your code does the latter.Sure, now a glitch brings your network down for ten minutes, no report sent after reconnection.Sure, but how are you stopping it. You don't want it to report 59 times an hour. Your code is only half a solution. My now > next is complete. Need help in improvement Detecting start of new Order delay between execution 12 New comment
when i want to send report for each hour,i do like this:
reporthour:record which hour has been sent,to avoid send again.
if you want to handle at 01:31,07:31...just use (31 == TimeMinute(nowtime)) instead.
And if there is no tick at the top of the hour during the first minute, your code fails. It also fails over the weekend.
Just typed. Not compiled.
When run backtest on TF-H4. How to check TimeMinute(Time[0]) = 30,31.... (Etc.) ?
Sorry ! My language very weak.
But thanks for the tip.
And if there is no tick at the top of the hour during the first minute, your code fails. It also fails over the weekend.
Just typed. Not compiled.
thanks for your ideas~
if there is no tick at the top of the hour during the first minute
easy to improve,just changed to 10 >= TimeMinute(nowtime),not enough? 59 >= TimeMinute(nowtime) ~~~~
in fact,if the symbols has no tick in one minute,no need to run EA on it anymore~,my EA is running normally for months now.
It also fails over the weekend
when the market is closed in weekend,there in no tick to drive onStart() and the EA is closed.i don't think it's a problem.
thanks again~
Moggy:
when the market is closed in weekend,there in no tick to drive onStart() and the EA is closed.i don't think it's a problem.
easy to improve,just changed to 10 >= TimeMinute(nowtime),not enough?
59 >= TimeMinute(nowtime) ~~~~
You missed the point. If you want to send a report at the top of the hour, it may not on market open.
Market closed at 04:59 ET Friday - no report sent, not top of the hour.
Market opens at 18:00 ET Sunday - no tick for the first minute, no report sent.
Either you want a report sent at the top of the hour, every hour or you don't. Your code does the latter.