yang_zhang
Yang-Zhang volatility estimator
yang_zhang
examples/site_showcase.rs// Yang-Zhang volatility estimator (Yang and Zhang 2000): the overnight variance, the open-to-close variance and the Rogers-Satchell variance combined, rooted and annualised with periods_per_year, in percent; needs the close before the window, so the first value comes one bar after the period, and a window with a non-positive price publishes nothing
// Defaults of "yang_zhang" (see the indicator reference)
let params = HashMap::from([
("period".to_string(), 20.0),
("periods_per_year".to_string(), 252.0),
]);
let mut indicator = build_checked("yang_zhang", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}