OPEN-SOURCE SCRIPT

Double CCI

已更新
The Commodity Channel Index (CCI) is a momentum oscillator used in technical analysis primarily to identify overbought and oversold levels by measuring an instrument's variations away from its statistical mean. Besides overbought/oversold levels, CCI is often used to find reversals as well as divergences. Originally, the indicator was designed to be used for identifying trends in commodities, however it is now used in a wide range of financial instruments.

There are several steps involved in calculating the CCI. The following example is for a typical 14 Period CCI:

CCI = (Typical Price - 14 Period SMA of TP) / (.015 x Mean Deviation)
Typical Price (TP) = (High + Low + Close)/3
Constant = .015
The Constant is set at .015 for scaling purposes. By including the constant, the majority of CCI values will fall within the 100 to -100 range.

Mean Deviation:
1) Subtract the most recent 14 Period Simple Moving from each typical price (TP) for the Period.
2) Sum these numbers strictly using absolute values.
3) Divide the value generated in step 2 by the total number of Periods (14 in this case).

Overbought and Oversold conditions can be used in their more traditional sense to identify future reversals. Remember true overbought/oversold thresholds values can and often do vary between instruments.

During a Bullish Trend, price crossing above the overbought threshold may indicate strong confidence in the move and price will continue to rise.

During a Bearish Trend, price crossing below the oversold threshold may indicate strong confidence in the move and price will continue to fall.

The first option is a modified CCI indicator that uses the "Arnaud Legoux Moving Average" instead of the SMA, and the source uses the VWAP instead of the HLC3. Added to this version an option to calculate CCI with different types of moving averages:
Green dots mean they are overbought
Orange dots mean they are oversold

Added a "SuperTrend Background" based on the modified CCI indicator:
Bull event = CCI crossing over the 0 line
Bear event = CCI crossing below the 0 line

Added a signal as EMA (modified CCI, signal length)

The second option is a standard CCI indicator that shows a coloured histogram of important levels, giving a good visual of the CCI levels. Added to this version is an extra coloured level +/-200 and an option to use Traditional CCI calculations according to user JustUncleL

LEVELS:
Aqua: Greater than 200.
Lavender: Greater than 100 and less than 200.
Dark Lavender: Greater than 0 and less than 100.
Dark Coral: Less than 0 and greater than -100.
Coral: Less than -100 and greater than -200.
Light Red: Less than -200.
版本注释
Migrated to v5.

Code reorganization and improvement.

Added "HLCC4" source.

Added alternate moving average types:
- Zero Lag
- COVWMA: Coefficient of Variation Weighted Moving Average.
- FRAMA: Fractal Adaptive Moving Average.
- Double Weighted Moving Average
- Double Volume-Weighted Moving Average
- Median

Added the crossings of the line 100 and -100 in the form of a diamond.

In the CCI Signal, you can now change the type of moving average.
almaarnaudlegouxmovingaverageCentered OscillatorsCommodity Channel Index (CCI)supertrend

开源脚本

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

想在图表上使用此脚本?

免责声明