pub fn cci(
highs: &[f64],
lows: &[f64],
closes: &[f64],
period: usize,
) -> Result<Vec<Option<f64>>>Expand description
Calculate Commodity Channel Index (CCI).
CCI measures the variation of a security’s price from its statistical mean. Formula: CCI = (Typical Price - SMA of Typical Price) / (0.015 * Mean Deviation)
Typical Price = (High + Low + Close) / 3
§Arguments
highs- High priceslows- Low pricescloses- Close pricesperiod- Number of periods
§Example
use finance_query::indicators::cci;
let highs = vec![10.0, 11.0, 12.0, 13.0];
let lows = vec![8.0, 9.0, 10.0, 11.0];
let closes = vec![9.0, 10.0, 11.0, 12.0];
let result = cci(&highs, &lows, &closes, 3).unwrap();