cci
Commodity Channel Index
cci
examples/site_showcase.rs// Commodity Channel Index (value is the EMA(avg_len) of the raw CCI; avg_len = 1 gives the raw line)
// Defaults of "cci" (see the indicator reference)
let params = HashMap::from([
("avg_len".to_string(), 3.0),
("cci_len".to_string(), 20.0),
("overbought".to_string(), 100.0),
("oversold".to_string(), -100.0),
]);
let mut indicator = build_checked("cci", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}