OPEN-SOURCE SCRIPT

[blackcat] L1 Reverse Choppiness Index

Cập nhật
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.
Phát hành các Ghi chú
upgrade to v5
blackcat1402Volatility

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


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
Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm