Commodity Channel Index ( CCI ) Using Python
The CCI compares the current price to an average price over a period of time. The indicator fluctuates above or below zero, moving into positive or negative territory. While most values, approximately 75%, fall between -100 and +100, about 25% of the values fall outside this range, indicating a lot of weakness or strength in the price movement.
CCI is calculated with the following formula:
(Typical Price - Simple Moving Average) / (0.015 x Mean Deviation)
When the CCI is above +100, this means the price is well above the average price as measured by the indicator. When the indicator is below -100, the price is well below the average price.
A basic CCI strategy is used to track the CCI for movement above +100, which generates buy signals, and movements below -100, which generates sell or short trade signals.
Investors may only want to take the buy signals, exit when the sell signals occur, and then re-invest when the buy signal occurs again.
Here I've used Python to build a CCI indicator.
Comments
Post a Comment