I try calculate by me self with this formula (In code)
#property strict int OnInit() { MqlDateTime _Time; TimeToStruct(TimeCurrent(),_Time); Print("_Time.day_of_year = "+_Time.day_of_year); Print("TimeDayOfYear(TimeCurrent()) = "+TimeDayOfYear(TimeCurrent())); Print("My calculate = "+double(((double)TimeCurrent()-(double)StringToTime("01.01.2024"))/(1440.0*60.0))); return(INIT_SUCCEEDED); }
The result is 108.6861921296296 So the correct value is 108 days. So the function TimeDayOfYear() is incorrect calculate.
Please send this error to the Metaqutes developer. Thank you.
https://www.mql5.com/en/docs/constants/structures/mqldatetime
{
int year; // Year
int mon; // Month
int day; // Day
int hour; // Hour
int min; // Minutes
int sec; // Seconds
int day_of_week; // Day of week (0-Sunday, 1-Monday, ... ,6-Saturday)
int day_of_year; // Day number of the year (January 1st is assigned the number value of zero)
};
TimeDayOfYear
Returned value
Day (1 means 1 January,..,365(6) does 31 December) of year of the specified date.
These are outdated functions (highlighted with a red rectangle in the screenshot), do not use outdated functions.
Okay, are there any other functions that have outdated?
Let me remind you that MT4 is no longer being developed. Of course, there are other outdated features in MT4. But I don't think anyone can give you an exhaustive list of them.
The first thing that comes to my mind is that all 'iXXXOnArray' are broken (and no one will fix them). I can't remember anything else offhand.
I can't remember anything else offhand.
AccountFreeMarginCheck may not work correctly, if I'm not mistaken. I abandoned it a long time ago, as far as I remember, because it did not work correctly.
But I don't think anyone can give you an exhaustive list of them.
Usually, a person remembers what he uses, and not what he abandoned.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
It's should same value ? I also tested with the function TimeCurrent(Time) also gives the same results as the function TimeToStruct().
This therefore raises the question, which result is correct? But no matter what, both of these functions should produce the same day_of_year results.