kestrel-chartkitv0.49.0

← All examples

nadaraya_watson

Gaussian kernel regression of the close at the newest bar, with an envelope of mult mean absolute errors

nadaraya_watson

examples/site_showcase.rs
// Gaussian kernel regression of the close at the newest bar, with an envelope of `mult` mean absolute errors (extras `upper`, `lower`). Only past bars are used, so a value never changes later. Published from bar 2 * lookback - 1.
// Defaults of "nadaraya_watson" (see the indicator reference)
let params = HashMap::from([
    ("bandwidth".to_string(), 8.0),
    ("lookback".to_string(), 50.0),
    ("mult".to_string(), 3.0),
]);
let mut indicator = build_checked("nadaraya_watson", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Gaussian kernel regression of the close at the newest bar, with an envelope of `mult` mean absolute errors (extras `upper`, `lower`). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 1 alerts in view, the latest as markers.Gaussian kernel regression of the close at the newest bar, with an envelope of `mult` mean absolute errors (extras `upper`, `lower`). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 1 alerts in view, the latest as markers.
  • Moving averages, bands and trend lines
  • unit: Price