Linear Correlation Oscillator

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:


Become a Patreon and get access to exclusive technical indicators!

You can also check out some of the indicators I made for luxalgo :
Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?