Reputation: 11694
I want to draw a horizontal trendline that extends from today to tomorrow, And I have trouble getting time tomorrow.
for example today is 2021.12.17 00:00:00
Comment( iTime(_Symbol, PERIOD_D1, 0) + (PERIOD_D1*60) );
// Today: 2021.12.17 00:00:00
// MQL4: 2021.12.18 00:00:00 ... it's ok.
// MQL5: 2021.12.28 09:28:00 ... it's not ok! why?
MQL4: As you can see in the code above, in mql4, through the iTime
function and adding a period, the date of tomorrow can be obtained, it's return 2021.12.18 00:00:00
.
MQL5: But this code shows date 2021.12.28 09:28:00
in mql5.
In other words, PERIOD_D1
is equal to 1440
in mql4 but in mql5 is equal to 16408
, Why?
Comment(PERIOD_D1);
// MQL4: 1440
// MQL5: 16408 why?!!!
Upvotes: 0
Views: 991
Reputation: 1383
Unlike MQL4, PERIOD_D1 does not relate to the amount of minutes in the period in MQL5. The simple workaround is to add (1440*60) to iTime().
Alternatively, use PeriodSeconds() as below
iTime(_Symbol, PERIOD_D1, 0) + PeriodSeconds(PERIOD_D1)
Upvotes: 4