OPEN-SOURCE SCRIPT

Cross-Asset Correlation Trend Indicator

Cross-Asset Correlation Trend Indicator

This indicator uses correlations between the charted asset and ten others to calculate an overall trend prediction. Each ticker is configurable, and by analyzing the trend of each asset, the indicator predicts an average trend for the main asset on the chart. The strength of each asset's trend is weighted by its correlation to the charted asset, resulting in a single average trend signal. This can be a rather robust and effective signal, though it is often slow.

Functionality Overview:
The Cross-Asset Correlation Trend Indicator calculates the average trend of a charted asset based on the correlation and trend of up to ten other assets. Each asset is assigned a trend signal using a simple EMA crossover method (two customizable EMAs). If the shorter EMA crosses above the longer one, the asset trend is marked as positive; if it crosses below, the trend is negative. Each trend is then weighted by the correlation coefficient between that asset’s closing price and the charted asset’s closing price. The final output is an average weighted trend signal, which combines each trend with its respective correlation weight.

Input Parameters:
  • EMA 1 Length: Sets the period of the shorter EMA used to determine trends.
  • EMA 2 Length: Sets the period of the longer EMA used to determine trends.
  • Correlation Length: Defines the lookback period used for calculating the correlation between the charted asset and each of the other selected assets.
  • Asset Tickers: Each of the ten tickers is configurable, allowing you to set specific assets to analyze correlations with the charted asset.
  • Show Trend Table: Toggle to show or hide a table with each asset’s weighted trend. The table displays green, red, or white text for each weighted trend, indicating positive, negative, or neutral trends, respectively.
  • Table Position: Choose the position of the trend table on the chart.


Recommended Use:
As always, it’s essential to backtest the indicator thoroughly on your chosen asset and timeframe to ensure it aligns with your strategy. Feel free to modify the input parameters as needed—while the defaults work well for me, they may need adjustment to better suit your assets, timeframes, and trading style.

As always, I wish you the best of luck and immense fortune as you develop your systems. May this indicator help you make well-informed, profitable decisions!
correlationCorrelation Coefficient (CC)correlationtradingExponential Moving Average (EMA)investingOscillatorstradingTrend Analysistrendfollowingtrendtradertrendtrading

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian