halftrend
HalfTrend: a trend line from the extremes and averages of the last amplitude bars, with an ATR envelope
halftrend
examples/site_showcase.rs// HalfTrend: a trend line from the extremes and averages of the last `amplitude` bars, with an ATR envelope (extras `trend`, `atr_high`, `atr_low`). It starts undecided and watches both sides instead of starting up; the first line is seeded with the extreme that decided it. Published once decided from bar atr_len.
// Defaults of "halftrend" (see the indicator reference)
let params = HashMap::from([
("amplitude".to_string(), 2.0),
("atr_len".to_string(), 100.0),
("deviation".to_string(), 2.0),
]);
let mut indicator = build_checked("halftrend", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}