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

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明