variance_ratio
Lo-MacKinlay variance ratio
variance_ratio
examples/site_showcase.rs// Lo-MacKinlay variance ratio (1988) of the log price, the returns being logarithms of price ratios: the variance of overlapping lag-bar returns over the variance of one-bar returns, both bias-corrected; above 1 the returns are positively autocorrelated, below 1 negatively, 1 is a random walk; extra z is the homoskedastic test statistic and can be negative
// Defaults of "variance_ratio" (see the indicator reference)
let params = HashMap::from([
("lag".to_string(), 4.0),
("period".to_string(), 100.0),
]);
let mut indicator = build_checked("variance_ratio", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}