I once said that it is a good idea to start the year on 1 March instead of 1 January. Then the curve February becomes the last month. Then you can apply the formula to find the month:
Nikolai Semko #: I once said that it was a good idea to start the year on 1 March rather than 1 January.
Perhaps that's how it used to be. It's not for nothing that they say the Slavs had their new year in March.
See Latin/Sanskrit: 7 - septem/sapta, 8 - octo/ashta, 9 - novem/nava, 10 - decem/dasha. Accordingly, the 11th month was January and the 12th month was February.
By the way, I tried to force your function to use a structure (to make the experiment more fair😄) and this did not affect performance - the result is the same (the difference is within the measurement error limits).
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.
I once said that it is a good idea to start the year on 1 March instead of 1 January. Then the curve February becomes the last month.
Then you can apply the formula to find the month:
Check out this implementation.
Forum on trading, automated trading systems and testing trading strategies
Peculiarities of mql5 language, subtleties and techniques of work
fxsaber, 2024.04.16 18:31
Easy to understand the source code.
Check out this implementation.
Ha-ha, they didn't bother much there, they just threw in an array of 365 (or 366) elements.

maybe it's justified
Haha, they didn't bother much there, they just stuck a 365 (or 366) element array in there
maybe it's justified
If the speed is higher than the alternatives, it is 100% justified.
If the speed is higher than the alternatives, it is 100% justified.
I once said that it was a good idea to start the year on 1 March rather than 1 January.
Perhaps that's how it used to be. It's not for nothing that they say the Slavs had their new year in March.
See Latin/Sanskrit: 7 - septem/sapta, 8 - octo/ashta, 9 - novem/nava, 10 - decem/dasha. Accordingly, the 11th month was January and the 12th month was February.
Yeah, I checked, too.
the result:
function calculation time 1-3 ns. Light during this time passes 30 cm - 1 metre :)))I changed GetMonthTime4 name to a more descriptive one:
benchmark:
Results:
Wow! faster 100x times than native way.
Forget about StringToTime(). It is extremely slowwwww!I changed GetMonthTime4 name to a more descriptive one:
benchmark:
Results:
Wow! faster 100x times than native way.
Forget about StringToTime(). It is extremely slowwwww!Your code is well suited for compiler optimization.
Maximum Optimization:
No Optimization:
I'm just sharing the results of my runs
By the way, I tried to force your function to use a structure (to make the experiment more fair😄) and this did not affect performance - the result is the same (the difference is within the measurement error limits).
Forum on trading, automated trading systems and testing trading strategies
Libraries: Local Timezones and Local Session Hours
amrali, 2024.04.18 04:31
Update 18 April 2024 - version 1.88
Added the CreateDateTime internal method to construct datetime values from date components (year, month and day).
This is 100-120x times faster than assigning values to MqlDateTime struct then calling the StructToTime function.
I've changed the name GetMonthTime4 to be more descriptive:
Alternative.