period_midpoint
Midpoint
period_midpoint
examples/site_showcase.rs// Midpoint (high + low) / 2 of the last completed period of count units, held until the next period completes; extra new_period is 1 on the bar that completed one. Periods align to the epoch (second, minute, hour, day), to Mondays (week) and to the calendar (month: multiples of count from January)
// Defaults of "period_midpoint" (see the indicator reference)
let params = HashMap::from([
("count".to_string(), 1.0),
("unit".to_string(), 2.0),
("utc_offset_seconds".to_string(), 0.0),
]);
let mut indicator = build_checked("period_midpoint", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}Not yet verified: no independent second implementation yet.