The function is a smart subset of the StructToTime algorithm in mql5
Unfortunately, the source code of StructToTime is not analysed by the compiler, but is attached as an imformed function. Therefore, StructToTime counts all the fields of the structure at each call.
The MQL5 compiler is able not to count unused fields, but this requires the source code to be analysed.
MQ has repeatedly said that they will include the source code of standard functions at compilation. Unfortunately, this did not happen with StructToTime.
boost::posix_time, std, boost ::chrono... надо учиться эффективно использовать чужие велосипеды, иначе легко завязнуть в своих... Зачем нужна эта библиотека? Данная библиотека поможет в случаях, когда есть необходимость часто использовать метку времени и искать данные, имеющие взаимосвязь с разными промежутками времени. Например, когда нужно...
I once said that it's a good idea to start the year on 1 March instead of 1 January. Then the crooked February becomes the last month. Then we can apply the following logic to find the month:
int m1 = days/30;
if (m1 == days/31) month = m1; // более 80% случаевelse {...}
where days - number of days since the last 1 March I would do it myself, but it's time to sleep.
Most likely, all the functions there are very fast. You can take it as a basis for writing your own TimeToStruct_Custom. Then it will be much faster than the standard function.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
The function is a smart subset of the StructToTime algorithm in mql5
Unfortunately, the source code of StructToTime is not analysed by the compiler, but is attached as an imformed function. Therefore, StructToTime counts all the fields of the structure at each call.
The MQL5 compiler is able not to count unused fields, but this requires the source code to be analysed.
MQ has repeatedly said that they will include the source code of standard functions at compilation. Unfortunately, this did not happen with StructToTime.
mktime in C https://github.com/lattera/glibc/blob/master/time/mktime.c.
Perfectly formatted:
Easy to understand source code.
Easy to understand source code.
Nice codes although not the fastest.
Forum on trading, automated trading systems and testing trading strategies
Libraries: Local Timezones and Local Session Hours
amrali, 2024.04.16 18:40
Update 16 April 2024 - version 1.85
Replaced the GetNthSunday internal method with the more optimized GetMonthTime method.
Forum on trading, automated trading systems and testing trading strategies
Libraries: Local Timezones and Local Session Hours
amrali, 2024.04.17 00:27
Update 17 April 2024 - version 1.87
Replaced the TimeYear internal method with the more optimised GetYear method .
amrali #:
Genius! Thank you!
Let's start with the year.
Or the same in integer form.
Genius! That was cool. Thank you!
Good codes, although not the fastest.
Easy to convert to MQL. For example, finding the year.
I have not tested the speed.
Easy to convert to MQL. For example, finding the year.
I have not tested the speed.
faster than GetYear3() but not too much 1.5x
I once said that it's a good idea to start the year on 1 March instead of 1 January. Then the crooked February becomes the last month.
Then we can apply the following logic to find the month:
where days - number of days since the last 1 March
I would do it myself, but it's time to sleep.
faster than GetYear3(), but not too much 1.5x
Most likely, all the functions there are very fast. You can take it as a basis for writing your own TimeToStruct_Custom. Then it will be much faster than the standard function.