Function tech_analysis::rational_quadratic
source · pub fn rational_quadratic(
src: &Series,
look_back: i32,
relative_weight: f32,
start_at_bar: i32
) -> Result<Series, Box<dyn Error>>Expand description
Calculates the rational quadratic value for a given set of parameters.
This function takes a series of values, a lookback period, a relative weight, and a starting point. It then calculates the rational quadratic value for each element in the series based on the provided parameters.
Arguments
src- The input series of values.look back- The look back period used in the calculation.relative_weight- The relative weight used in the calculation.start_at_bar- The starting point for the calculation.
Returns
A new series containing the calculated rational quadratic values.
Example
use polars::prelude::*;
use tech_analysis::rational_quadratic;
let src = Series::new("data",vec![1.0, 2.0, 3.0, 4.0, 5.0]);
let result = rational_quadratic(&src, 2, 3.0, 1);
eprintln!("{:?}", result);
println!("{:?}", result);