How to get tomorrow date in mql5?
How to get tomorrow date in mql5?
Loading saved threads...
Sinac · External communityPost link
External question — Stack Overflow Stack Exchange
Author: Sinac
Original post: https://stackoverflow.com/questions/70391164
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
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?!!!
Quote
Report
PaulB · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: PaulB
Original post: https://stackoverflow.com/a/70405028
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
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)
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: Sinac Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/questions/70391164 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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?!!!
Checking account access…