kestrel-chartkitv0.43.0

← All examples

r_squared

R-squared of a least-squares line through the last period closes, 1 for a clean straight trend and near 0 f…

r_squared

examples/site_showcase.rs
// R-squared of a least-squares line through the last period closes, 1 for a clean straight trend and near 0 for noise; a window of equal closes reads 1
// Defaults of "r_squared" (see the indicator reference)
let params = HashMap::from([
    ("period".to_string(), 20.0),
]);
let mut indicator = build_checked("r_squared", &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.

R-squared of a least-squares line through the last period closes, 1 for a clean straight trend and near 0 for noise; a window of equal closes reads 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.R-squared of a least-squares line through the last period closes, 1 for a clean straight trend and near 0 for noise; a window of equal closes reads 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