Function stoch

Source
pub fn stoch(
    fastk_period: u32,
    slowk_period: u32,
    optInSlowK_MAType: TA_MAType,
    slowd_period: u32,
    optInSlowD_MAType: TA_MAType,
    high: &Vec<f64>,
    low: &Vec<f64>,
    close: &Vec<f64>,
) -> (Vec<f64>, Vec<f64>, TA_Integer)
Expand description

TA_STOCH - Stochastic

Input = High, Low, Close Output = double, double

ยงOptional Parameters

optInFastK_Period:(From 1 to 100000) Time period for building the Fast-K line

optInSlowK_Period:(From 1 to 100000) Smoothing for making the Slow-K line. Usually set to 3

optInSlowK_MAType: Type of Moving Average for Slow-K

optInSlowD_Period:(From 1 to 100000) Smoothing for making the Slow-D line

optInSlowD_MAType: Type of Moving Average for Slow-D

#Sample

let inReal: Vec<f64> = vec![
       1.087010, 1.087120, 1.087080, 1.087170, 1.087110, 1.087010, 1.087100, 1.087120, 1.087110,
       1.087080, 1.087000, 1.086630, 1.086630, 1.086610, 1.086630, 1.086640, 1.086650, 1.086650,
       1.086670, 1.086630,
];
let high = inReal.clone();
let low = inReal.clone();
let close = inReal.clone();
let (outSlowK,outSlowD, begin) = rust_ta_lib::wrapper::stoch(9,3,0,3,0,&high,&low,&close);
for (index, value) in outSlowK.iter().enumerate() {
       println!("outs index {} = {}", begin + index as i32 + 1, value);
        println!("outs index {} = {:?}", begin + index as i32 + 1, outSlowD.get(index));
 }