NariCapitalTrading

Kendall's Tau Correlation Regimes [NariCapitalTrading]

The "Kendall's Tau Correlation Regimes" indicator is designed to analyze price data and determine market regimes based on Kendall's Tau correlation coefficient. It provides insight into the strength and direction of the correlation between two data series: close price and a selected moving average.

User Inputs:

Period: Defines the lookback period for calculating Kendall's Tau correlation. It can be adjusted using the input slider, with a minimum value of 1.
Threshold: Sets the threshold for identifying bullish and bearish market regimes. The user can adjust this value within the range of 0.1 to 1.0 with step increments of 0.1.
MA Type: Allows users to select the type of moving average to be used in the correlation calculation. Options include Simple Moving Average (SMA), Exponential Moving Average (EMA), and Hull Moving Average (HMA).

Kendall's Tau Correlation Calculation:

Calculates Kendall's Tau correlation coefficient between the closing price and the selected moving average.
Kendall's Tau measures the strength and direction of the ordinal association between two data series. It assesses whether the data pairs are in the same order or not.
The calculation involves counting concordant and discordant pairs of data points and then computing the coefficient.

Market Regime Identification:

Based on the threshold defined by the user, the indicator identifies two market regimes: bullish and bearish.
A regime is considered bullish when the Kendall's Tau correlation coefficient is greater than the threshold.
A regime is considered bearish when the Kendall's Tau correlation coefficient is less than the negative of the threshold.

Plotting:

The indicator plots the calculated Kendall's Tau correlation coefficient as a blue line on a separate indicator pane.
It also highlights bullish regimes with a green background and bearish regimes with a red background.

Conclusion:
The "Kendall's Tau Correlation Regimes" indicator provides traders with a visual aid for assessing market regimes based on the strength of correlation between price and a selected moving average.

Disclaimer: This indicator is for educational and informational purposes only.
Release Notes:
def val threshold update

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?