kestrel-chartkitv0.33.0

← All examples

lsma

Least Squares Moving Average / Linear Regression

lsma

examples/site_showcase.rs
// Least Squares Moving Average / Linear Regression
// Defaults of "lsma" (see the indicator reference)
let params = HashMap::from([
    ("period".to_string(), 25.0),
]);
let mut indicator = build_checked("lsma", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Least Squares Moving Average / Linear Regression. 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.Least Squares Moving Average / Linear Regression. 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.
  • Moving averages, bands and trend lines
  • unit: Price