Average CCI - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources - MetaTrader 5 Resources


The Commodity Channel Index ( CCI ) is an oscillator originally proposed by Donald Lambert in 1980.
CCI measures how different a security is from a statistical average.
CCI is calculated as the difference between a commodity's typical price and its simple moving average divided by the average absolute deviation of the typical price. The index is usually scaled by the reciprocal 0.015 to provide a more readable number:

Where is the typical price (highest price + lowest price + closing price)/3 , SMA is the simple moving average, and MD is the mean absolute deviation.
For scaling purposes, Lambert set the constant to 0.015 to ensure that approximately 70% to 80% of CCI values would fall between −100 and +100. CCI fluctuates around zero. A quantity whose percent CCI value falls between +100 and −100 depends on the number of periods used by the quantity. The shorter the CCI, the less volatile the CCI is as a percentage of values between +100 and −100. Conversely, the more periods used to calculate the CCI, the higher the percentage of values between +100 and -100.
Sometimes CCI is "tense" - if you use it for signals based on horizontal crossovers, it can produce a lot of false signals. One possible approach is to pre-filter prices before being used in CCI calculations (this reduces latency significantly compared to smoothing the calculated CCI). This version does the following: Use pre-filtered prices for CCI calculations. You can use the common set of average types:
Choose one of 3 coloring modes (slope, level or color change on zero crossing) and you can use the color change as a signal.

Attachment download
📎 cci_of_average.mq5 (8.94 KB)
Source: MQL5 #22742
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •