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 whole problem is in the second cycle. It simultaneously handles left and right branches from potential extremum and hence it only goes through (N - 1)/2 bars, but that is not enough. Measurements show that time spent on searching for an extremum in an arithmetic progression depends on the period N, which is very, very bad:
At least one break is missing:
Better still, really split the top and bottom, and stop immediately after an unsuccessful check.
If all else fails, try OCL.
It won't make a big difference.
At least one break is missing:
Better still, really separate top and bottom, and stop immediately after an unsuccessful check.
Still, OCL (or paralleling in the general sense) is not an algorithmic optimization, but rather a technical one.
I doubt that in your case there is a need to parallelize the fastest O(N)-variant solution to the problem.
He will.
No yada yada? Show me.
So, good luck. To discuss optimization of an algorithm with complexity that is linearly dependent on the value of a parameter is probably something you have nothing to do.
No yada yada? Show me.
Anyway, good luck. Discuss the optimization of an algorithm with complexity linearly dependent on the value of a parameter - you really have nothing to do.
OK, I will finish completing the algorithm and post the paralleling results in the studio.
Still, OCL (or paralleling in the general sense) is not an algorithmic optimization - it is more of a technical one.
I doubt that there is a need to parallelize the fastest O(N)-variant solution in your case.
How can I put it. Any parallelization is always a serious complication of algorithms. Moreover, if you don't parallelize an algorithm with linear dependence on the amount of data, what else can you parallelize?
In short, I will rewrite the algorithm and see what it brings.
Again, separation of tops and bottoms results in two passes for. This doubles the time of search. Separation by itself does not give performance gain without using multithreading, especially for small n.
How can you be so sure?
My check shows otherwise:
01:29:25 SpeedTest EURUSD,M15 inputs: Interations=10000; pperiod=10;
01:29:25 SpeedTest EURUSD,M15: Number of bars = 3780
01:30:46 SpeedTest EURUSD,M15: Original function: 81.558 sec, extrema: 131 / 121
01:31:10 SpeedTest EURUSD,M15: With my edit (break): 23.291 sec, extrema: 131 / 121
01:31:27 SpeedTest EURUSD,M15: With my break (break): 17.565 sec, extrema: 131 / 121
Attached is an mq4 script.
One more test to complete the picture:
01:38:56 SpeedTest EURUSD,M1 inputs: Interations=1000; pperiod=100;
01:38:56 SpeedTest EURUSD,M1: Number of bars = 33896
01:50:19 SpeedTest EURUSD,M1: Original function: 683.565 sec, extrema: 121 / 127
01:50:54 SpeedTest EURUSD,M1: With my edit (break): 34.383 sec, extrema: 121 / 127
01:51:16 SpeedTest EURUSD,M1: With my break (break): 22.714 sec, extrema: 121 / 127