kestrel-chartkitv0.43.0

← All examples

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", &params)?;

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.

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. 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.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. 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.
  • Market structure and patterns
  • unit: Price