TradingView
rumpypumpydumpy
16 sep 2020 05:24

Ehler's Autocorrelation Periodogram - RSI/MFI 

Ethereum / U.S. dollarBitstamp

Beskrivning

Warning! Frequently hits the execution time limit for scripts.
Especially on initially adding to your chart. Often requires toggling show/hide indicator to get it to complete script execution within the time limit. YMMV!

From TASC Sept 2016 this is Ehler's Autocorrelation periodogram. A means of determining the dominant cycle ("ideal" indicator length / dynamic length).

As an example it's applied here to RSI or MFI. Lower indicator segment displays the autocorrelation spectrum and the computed dominant cycle. Upper segment is RSI/MFI.

Versionsinformation

Corrected error in calculation

Versionsinformation

Another fix and initial r values

Versionsinformation

Corrected HP filter
Kommentarer
harkalada31
Great script!
Please check lines 68 and 69
In line 68 instead of cosine function there are must be sine function
In line 69 instead expression "array.get(cospart, period) + array.get(corr, n) +" there are must be "pow(array.get(cospart, period),2)"
rumpypumpydumpy
@harkalada31, Thank you for pointing that out
harkalada31
You're welcome. Also please check line 74 after "0.2 * pow(array.get(sqsum, period),2) +" there are must be 0.8*array.get(r2, period) according J.Ehlers article.
rumpypumpydumpy
@harkalada31, Thanks again :) I must have been high or something. It brings up the issue of initial R1 being empty. I think this should be correct now.
harkalada31
@rumpypumpydumpy, you're welcome! I found another problem. Please check line 24, you forgot to divide the expression on cos(c/48). I compared your script with my own and after that correction we have identical results (i applied sine wave as a test signal).
A_Traders_Edge
Hey buddy, fanastic job on this one
awang3648
is there by chance a thinkscript version of this?
simwai
So good!
labtab
Thank you for your great effort.
dominantcycle and smoothed dominant cycle - both are terribly small compared to all other calculations available.
Will you please review it.
Just noticed it. Is there any reason for it.
Thank you for your time n attention.
arviman
One question - is the MFI\RSI's period length automatically tuned by the autocorrelation here?
Mer