kestrel-chartkitv0.49.0

← All examples

parkinson

Parkinson volatility estimator

parkinson

examples/site_showcase.rs
// Parkinson volatility estimator (Parkinson 1980): the mean squared high-low log range over the window, scaled by 4 ln 2, rooted and annualised with periods_per_year, in percent; a window with a non-positive high or low publishes nothing
// Defaults of "parkinson" (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("parkinson", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Parkinson volatility estimator (Parkinson 1980): the mean squared high-low log range over the window, scaled by 4 ln 2, rooted and annualised with periods_per_year, in percent; a window with a non-positive high or low publishes nothing. 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.Parkinson volatility estimator (Parkinson 1980): the mean squared high-low log range over the window, scaled by 4 ln 2, rooted and annualised with periods_per_year, in percent; a window with a non-positive high or low publishes nothing. 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