blackcat1402

[blackcat] L1 Reverse Choppiness Index

blackcat1402 已更新   
The Choppiness Index is a technical indicator that is used to measure market volatility and trendiness. It is designed to help traders identify when the market is trending and when it is choppy, meaning that it is moving sideways with no clear direction. The Choppiness Index was first introduced by Australian commodity trader E.W. Dreiss in the late 1990s, and it has since become a popular tool among traders.

Today, I created a reverse version of choppiness index indicator, which uses upward direction as indicating strong trend rather than a traditional downward direction. Also, it max values are exceeding 100 compared to a traditional one. I use red color to indicate a strong trend, while yellow as sideways. Fuchsia zone are also incorporated as an indicator of sideways. One thing that you need to know: different time frames may need optimize parameters of this indicator. Finally, I'd be happy to explain more about this piece of code.

The code begins by defining two input variables: `len` and `atrLen`. `len` sets the length of the lookback period for the highest high and lowest low, while `atrLen` sets the length of the lookback period for the ATR calculation.

The `atr()` function is then used to calculate the ATR, which is a measure of volatility based on the range of price movement over a certain period of time. The `highest()` and `lowest()` functions are used to calculate the highest high and lowest low over the lookback period specified by `len`.

The `range`, `up`, and `down` variables are then calculated based on the highest high, lowest low, and closing price. The `sum()` function is used to calculate the sum of ranges over the lookback period.

Finally, the Choppiness Index is calculated using the ATR and the sum of ranges over the lookback period. The `log10()` function is used to take the logarithm of the sum divided by the lookback period, and the result is multiplied by 100 to get a percentage. The Choppiness Index is then plotted on the chart using the `plot()` function.

This code can be used directly in TradingView to plot the Choppiness Index on a chart. It can also be incorporated into custom trading strategies to help traders make more informed decisions based on market volatility and trendiness.

I hope this explanation helps! Let me know if you have any further questions.
版本注释:
upgrade to v5

Avoid losing contact!Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq 防止失联,请立即行动,加入本猫聊天群: discord.com/invite/ZTGpQJq
开源脚本

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

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?