kestrel-chartkitv0.49.0

← All examples

autocorrelation

Rolling sample autocorrelation of one-bar log returns at a lag, as in Box and Jenkins: the denominator runs…

autocorrelation

examples/site_showcase.rs
// Rolling sample autocorrelation of one-bar log returns at a lag, as in Box and Jenkins: the denominator runs over all returns of the window with no small-sample adjustment; -1..1
// Defaults of "autocorrelation" (see the indicator reference)
let params = HashMap::from([
    ("lag".to_string(), 1.0),
    ("period".to_string(), 50.0),
]);
let mut indicator = build_checked("autocorrelation", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Rolling sample autocorrelation of one-bar log returns at a lag, as in Box and Jenkins: the denominator runs over all returns of the window with no small-sample adjustment; -1..1. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 0 alerts in view, the latest as markers.Rolling sample autocorrelation of one-bar log returns at a lag, as in Box and Jenkins: the denominator runs over all returns of the window with no small-sample adjustment; -1..1. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 0 alerts in view, the latest as markers.
  • Volatility and trend strength
  • unit: Ratio