
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 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:
But as Alain pointed, size * (size-1) is always even.
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:
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... :(
Using a sine wave model, I calculated the error for a moving average and a moving median:
After much thought, I added the "weird" (?) applied price OC2. In my short experience, I already suspected that (High+Low)/2 was a wise choice. If High/Low (Ask/Bid) is not available or reliable, using OC2 as alternative has proved as an excellent choice.
I will investigate further with complex wave functions and post results.
Best regards.
For some reason I discovered that I was doing the following:
https://en.wikipedia.org/wiki/Theil%E2%80%93Sen_estimator
(I lack formal maths education)

We shall not forget. :)