Features of the mql5 language, subtleties and tricks - page 252
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.