xel_arjona

Weighted Harrell-Davis Quantile Estimator with AbsoluteDeviation


QUANTILE ESTIMATORS
Weighted Harrell-Davis Quantile Estimator with Absolute Deviation Fences.


DISCLAIMER:

The Following indicator/code IS NOT intended to be a formal investment advice or recommendation by the author, nor should be construed as such. Users will be fully responsible by their use regarding their own trading vehicles/assets.

The following indicator was made for NON LUCRATIVE ACTIVITIES and must remain as is, following TradingView's regulations. Use of indicator and their code are published for work and knowledge sharing. All access granted over it, their use, copy or re-use should mention authorship(s) and origin(s).


WARNING NOTICE!

THE INCLUDED FUNCTION MUST BE CONSIDERED FOR TESTING. The models included in the indicator have been taken from open sources on the web and some of them has been modified by the author, problems could occur at diverse data sceneries, compiler version, or any other externality.


Purpose:

Weighted Quantiles or <<Percentile Ranking>> are quite difficult to find on must systems, also it's non-weighted approach are rarely used to estimate the location parameter of price distribution WICH IS NOT NORMAL, all this in favour of it's non-robust counterpart, the Arithmetic rolling Mean or <<Moving Average>> and it's weighted variants like the WMA , VWAP , etc.

Also, a big drawback from this is that must statistics derived from Normal-Distribution parameter location (the Mean) definitely will not fit for an efficient, nor robust estimation for price distributions, so their moments like the standard deviation, kurtosis , skewness, etc. will not be the better tools to build derived algorithms or technical indicators among price/ volume .

In an effort searching better statistical tools for price distributions, I found the excellent work of Andrey Akinshin that took me to port some of their Math research contributions for the compute benchmarking field, and bring it here at the TradingView ecosystem to take a shot at the price distribution crazy fields. For a better detail of what the weighted Harrell-Davis Quantile Estimator can do, who better than drink directly from the source at References:


References:



Licensing:

This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International Copyright (c) 2021 ( CC BY-NC-SA 4.0)


Copyright's & Mentions:

Versionshinweise:
  • Replaced full betaCDF Harrell-Davis QE algorithm 'function_wHDquantile()' with a custom-trimmed betaCDF version 'function_twHDquantile()' for faster calculation and more robust capacity without loosing it's efficiency..
  • Added betaPDF functions as needed dependencies for replaced 'function_twHDquantile()' function.
  • Replaced full betaCDF Harrell-Davis Quantile Absolute Deviation with the custom-trimmed version 'function_twHDquantileAbsDev()' for consistency with new trimmed HD Quantile Estimator, assertions added for correct (volume) weights in deviation algorithm calculations, speed optimization added making use of TradingView's internal array.median() function when sampleWeights declared to ones (not or equal weighting).
  • Code clean-ups, comment's, tooltips, and styling corrections.
Versionshinweise:
  • For the function_twHDquantile(), the effective sample size from the sum of all weights normalized by the maximum weight has been replaced with the Kish method, as It was changed at source code from where this port was sourced and referenced on the author's blog entry: -Using Kish's effective sample size with weighted quantiles-.
  • Functions, procedures and methods was organized in a much better hierarchy approach.
  • Script code was cleaned for better visualization and understanding.
  • More typo fixes. XD
Open-source Skript

Ganz im Sinne von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es verstehen und überprüfen können. Ein Hoch auf den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Publikation unterliegt den Hausregeln. Sie können das Skript den Favoriten hinzufügen, um es auf dem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?

Kommentare

500 Coins
+3 Antworten
xel_arjona PineCoders
@PineCoders, Quite glad for the mention, Ed-Pick' and coins, but must of it from contribute something to the wonderful community here at TradingView.
+3 Antworten
its great work, but man the loading is intense
200 Coins
+2 Antworten
xel_arjona OmniTekTrading
@OmniTekTrading, Thanks a lot for your kindly donation! I know, robustness/efficiency of order statistics (sorted derived functions) are compute intensive. Here you have twice the expense if plotting the Quantile Absolute Deviation, and x3 if using DoubleQAD algorithm which is statistically more precise with non-parametric distributions, like the one observed in price series. Will try to experiment with other algorithms in the future that approximate the estimation in favor of computational speed, like the P2 method: https://doi.org/10.1145/4372.4378
Antworten
Good work Thank you for sharing
100 Coins
Antworten
very well done!
500 Coins
Antworten
xel_arjona LonesomeTheBlue
@LonesomeTheBlue, Thank You very much..!
+1 Antworten
Excellent work!
500 Coins
Antworten
xel_arjona rumpypumpydumpy
@rumpypumpydumpy, Wow! Thank You very much..! Hope it helps for derived work.
Antworten
Salut, i noitced that when middle line is completely overlap with lower line, trend is always going up. This is great buy signal, imo. How can we create strategy based on this idea? Thanks.
+2 Antworten