Features of the mql5 language, subtleties and tricks - page 236
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
A faster implementation of the standard PeriodSeconds() function:
Looked at the format.
Probably not faster. I have heard, though, about the marvellous speed of switch.
Looked at the format.
Probably won't speed it up. Heard about the miraculous speed of the switch, though.
It looks longer, but I didn't notice any difference in performance.
so I think a one-line version is still preferable.
looks longer
and now to convert all this into matrices and ONX :-)
Yeah. You could do that. More readable.
performance on my laptop is the same.
fxsaber #:
By the way, I was wrong in my previous posts. For some reason I thought there were 28 days in a month, not 30. I don't understand where I got that.
I can't fix my posts that are more than 1 hour old anymore.
So my correct version is this:
No one needs seconds of the month, though, since months are different in length
By the way, I was wrong in my previous posts. For some reason I thought there were 28 days in a month, not 30. I don't understand where I got it.
I can't fix my posts that are older than 1 hour.
So my correct version is as follows:
No one needs seconds of the month, though, since months are different in length
What makes you think this is faster than PeriodSeconds(x) ?
the test from this post
it is enough to compare the performance of getStartTimeOfBar() with PeriodSeconds() and with PeriodSecondsFast()
The comparison should be done on any TF except MN1
The performance is higher by about 2 times. Maybe 3 times taking into account that we measure the whole iteration.
or is it enough to compare these two values
the test from this post
it is enough to compare the work of getStartTimeOfBar() with PeriodSeconds() and with PeriodSecondsFast()
The comparison should be done on any TF except MN1
The performance is higher by about 2 times. Maybe 3 times taking into account that we measure the whole iteration.
or is it enough to compare these two values
I may be missing something, but I used your script to check PeriodSeconds (only).
I may be missing something, but I used your script to check PeriodSeconds (only).
my results from your test:
0 errors, 0 warnings, 234 msec elapsed, cpu='AVX2 + FMA3'
I don't like the test itself very much, because 10 million of the same calculations take place in the test. In this case, there is no guarantee that the compiler will not give surprises in its attempts to optimise the code.
And these values must be divided by 21 because there are 21*10 000 000 iterations in total.
However, this test also confirms my conclusions, but for my processor, which seems to be fresher and, therefore, uses modern performance features to the maximum and, therefore, is more objective because it is more up-to-date.
It would be interesting to see the results of this test for others.