Self-regressive Median Coefficient - page 7

To add comments, please log in or register
Arthur Albano
337
Arthur Albano  
Mladen Rakic:

The code of the complete indicator :

It draws this :


The code used in this indicator is different (different, faster,  way of preparing and passing array elements but the results are the same)  The 2 lines of code that need optimization remain the same (as it is obvious, since, practically, it is all that remains in the function calculation code)

Fixed:

double  QuantRegCoeff=(coeffSize%2==1) ?(CoeffBuffer[(coeffSize-1)/2]) : (0.5*(CoeffBuffer[coeffSize/2]+CoeffBuffer[coeffSize/2-1]));

But as Alain pointed, size * (size-1) is always even.

Files:
Arthur Albano
337
Arthur Albano  
Alain Verleyen:

So at my surprise, I didn't succeed. The main optimization idea I had was to reduce the number of division operations needed :

As this operation is done in a loop for every candle i, there are a lot of repetitions of the exact same operation. So the idea was to do all the operations once and to memorize them (see attached how I did). However it doesn't improve this speed, even while the numbers of operations was reduced by a factor 16 !

From 64 millions to 4 millions division operations, but no change in execution time. I didn't expect that. That means double arithmetic CPU is very efficient and cached very well all the results.

Also, though this imbricated loop with division operations is time consuming, the main bottleneck in the ArraySort(), the speed impact is more than 3 times the one of the loops. So even if the "division" optimization had worked that global impact would have been low (~20% max).

That was an interesting exercise, even if it failed.

Attached the code (as we are on week-end I didn't pay attention to "live" update).

This makes more sense to me:

double  QuantRegCoeff=0.5*(CoeffBuffer[coeffSize/2]+CoeffBuffer[coeffSize/2-1]);
Files:
275327_AV.mq5 10 kb
Arthur Albano
337
Arthur Albano  

https://storage.tusur.ru/files/43224/2012_4.pdf

Done in SAS.

CPP:

http://www.aronaldg.org/webfiles/compecon/src/libscl_float.15-11-16/src/quantreg.cpp

Is it feasible in MQL5? Does anyone know? I cannot try it because I am offshore and cannot use MQL5... :(

To add comments, please log in or register