atr
Average True Range
atr
examples/site_showcase.rs// Average True Range (true-range average: build_typed accepts smoothing=rma|sma|ema|wma, build_checked the same as smoothing=0|1|2|3; rma is the default and the signal line stays Wilder-smoothed)
// Defaults of "atr" (see the indicator reference)
let params = HashMap::from([
("atr_len".to_string(), 14.0),
("sig_len".to_string(), 20.0),
("smoothing".to_string(), 0.0),
]);
let mut indicator = build_checked("atr", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}