Features of the mql5 language, subtleties and tricks - page 280

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
And inverse ?
I mean that TimeToStruct is usually paired with the inverse StructToTime function.
to find "first Monday of the previous month" , "the beginning of the current quarter" etc.
And just to decompose the current date into day-month-year (to know) it may be necessary once a day and this moment is not critical. Nobody calls TimeToStruct on every tick :-)
For the fastest replacement to the built-in TimeToStruct() function,
I suggest using this function :
The speed-up factor is approx. 4-5x (for the version without cache).
After applying optimizations from this paper "Euclidean Affine Functions and Applications to Calendar Algorithms":
Results:
/* Compiler Version: 4620, X64 Regular 13th Gen Intel Core i3-1305U, AVX2 + FMA3 1970.01.01 00:05:17 - 2099.11.29 23:56:35, random datetimes[] 5.20 ns, checksum = 151984615301017 // TimeToStruct2100 5.18 ns, checksum = 151984615301017 // TimeToStructFast 4.52 ns, checksum = 151984615301017 // TimeToStructFast2 4.87 ns, checksum = 151984615301017 // TimeToCalendar 5.62 ns, checksum = 151984615301017 // TimeToJulian 23.08 ns, checksum = 151984615301017 /// MQL's TimeToStruct() */
After applying optimisations from the article "Euclidean affine functions and their application to calendar algorithms ":
Thanks, very interesting solution.
You can use smaller numbers in the expression.
After applying optimizations from this paper "Euclidean Affine Functions and Applications to Calendar Algorithms":
Results:
Supposedly MQ should now replace the implementation of the inbuilt f-function with this one?
It should be checked for dates after 2100. The year is 365.2425 days long, not 365.25.
Supposedly, MQs should now replace the implementation of the inbuilt f-function with this one?
Supposedly, MQs should now replace the implementation of the inbuilt f-function with this one?
Also, why. Just replace it yourself. Look at the amralis library, it shows how to do it.
Meaning, if there is a better implementation than the stock one, it would make sense for MQ to replace the stock one with a better one.
Meaning, if there is a better implementation than the stock one, it would make sense for MQ to replace the stock one with a better one.