It can be seen that the processing speed has qualitatively increased and is now independent of the period of the extremum. It is true that for small N, especially for period 3, the speed is even slower, but as N increases, the speed increases rapidly and is almost twice as fast as for small N:
This seems to be due to the fact that break jumps and indexing transitions take some time and are effective over long distances. On small N, head-on brute-forcing turns out to be faster.
P.S. I have put execution of both functions Up() and Down() into asynchronous mode of execution. That is, they can be executed on both cores simultaneously. But it didn't increase performance. Apparently, the passes themselves are not resource-intensive and most of the time is spent on preparation and parsing of data, not on the iterations themselves.
hrenfx: However, it is still not the fastest option. But this is "blah blah" on my part since I'm not going to write a fast one.
Still relevant.
P.S.
C-4:
It can be seen that the processing speed has increased qualitatively and is now independent of the extremum period.
It depends, and not badly. In your case you just have such a source code (CVR) which just ends at minimum N. In general case the graph of dependence of speed of execution on period can be strikingly different from yours.
It depends, and not badly. In your case it is just a source (TSS) which ends at minimum N. In general case the graph of dependence of execution speed on period can drastically differ from yours.
A controversial statement. The algorithm is single-pass and the number of iterations, and hence the speed, is almost independent of N. It is true that there is one peculiarity of the algorithm due to which BP price extremums are equal to each other will cause a significant drop in performance. In all other cases I'm sure the dependence should be preserved. In this case a classical normally distributed random walk was taken as BP.
How can you be so sure?
My check shows otherwise:
The mq4 script is in the attachment.
However, it's still not the fastest option. But it's a 'blah blah' on my part, as I won't be writing a fast one.
However, it's still not the fastest option. But it's a "blah blah" on my part, as I won't write a fast one.
I won't either. I agree though - it could be faster.
Well don't! Wrecked:(
I'll write this algorithm myself, I already know how. Only now I'm sick, I'll have to put it off for a week.
C.T.D. wrote exactly that in his first post.
Cycle splitting does seem to work faster. But I don't understand why, as the passes become two.
And I won't. Although I agree - it can be faster.
I won't either, although faster is definitely possible ;)
I just noticed that one break is missing, so I can't go deep into it now.
Here is the final code. A maximum search function is presented. The function for finding minima is similar:
Here are the performance tests:
It can be seen that the processing speed has qualitatively increased and is now independent of the period of the extremum. It is true that for small N, especially for period 3, the speed is even slower, but as N increases, the speed increases rapidly and is almost twice as fast as for small N:
This seems to be due to the fact that break jumps and indexing transitions take some time and are effective over long distances. On small N, head-on brute-forcing turns out to be faster.
P.S. I have put execution of both functions Up() and Down() into asynchronous mode of execution. That is, they can be executed on both cores simultaneously. But it didn't increase performance. Apparently, the passes themselves are not resource-intensive and most of the time is spent on preparation and parsing of data, not on the iterations themselves.
However, it is still not the fastest option. But this is "blah blah" on my part since I'm not going to write a fast one.
Still relevant.
P.S.
It can be seen that the processing speed has increased qualitatively and is now independent of the extremum period.
Still relevant.
P.S.
It depends, and not badly. In your case it is just a source (TSS) which ends at minimum N. In general case the graph of dependence of execution speed on period can drastically differ from yours.