TradingView
alexgrover
31 sty 2021 12:04

Linear Correlation Oscillator 

EUR/USDOANDA

Opis

You don't need loops to get the rolling correlation between an input series and a linear sequence of values, this can be obtained from the normalized difference between a WMA and an SMA of the input series.

The closed-form solutions for the moving average and standard deviation of a linear sequence can be easily calculated, while the same rolling statistics for the input series can be computed using cumulative sums. All these concepts were introduced in previous indicators posts long ago.

This approach can allow to efficiently compute the rolling R-Squared of a linear regression, as well as its SSE.

Using the rolling correlation as a trend indicator is often attributed to John Ehlers with the correlation trend indicator (Correlation As A Trend Indicator), but the applications of this precise method can be traced back quite a while ago by a wide variety of users, in fact, the LSMA can be computed using this precise indicator. You can see an example where the correlation oscillator appears below:

tradingview.com/script/Te01hBsi-Logistic-Correlation/
Komentarze
PineCoders
ICEKI
Nice stuff as always; appreciated for your posting mate =D
PineCoders
This publication is now featured in our Editors' Picks: tradingview.com/scripts/editors-picks/ .
In the name of all TradingViewers, thank you for your valuable contribution to the community, and congrats!
Team_Sekoya
👏 🙌
Thanks
JazzByrd
Love this Indicator - thank you Alex for this and everything! Question - I'm trying to use this code and plot a higher timeframe correlation line using the request security function, BUT, pine will not accept 'cor' (cor = num/sqrt(vary*varx) as a variable or function. Anyone have any suggestions?
Więcej