bbands

Function bbands 

Source
pub fn bbands(
    period: u32,
    in_real: &Vec<f64>,
    in_db_dev_up: f64,
    in_db_dev_down: f64,
    in_ma_type: TA_MAType,
) -> (Vec<f64>, Vec<f64>, Vec<f64>, TA_Integer)
Expand description

TA_BBANDS - Bollinger Bands

Input = double Output = double, double, double

ยงOptional Parameters

optInTimePeriod:(From 2 to 100000) Number of period

optInNbDevUp:(From TA_REAL_MIN to TA_REAL_MAX) Deviation multiplier for upper band

optInNbDevDn:(From TA_REAL_MIN to TA_REAL_MAX) Deviation multiplier for lower band

optInMAType: Type of Moving Average

#Sample

let close_prices: 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 (outs,_,_, begin) = rust_ta_lib::wrapper::bbands( 10,&close_prices,0.2,0.3,rust_ta_lib::TA_MAType_TA_MAType_SMA);
for (index, value) in outs.iter().enumerate() {
       println!("outs index {} = {}", begin + index as i32 + 1, value);
 }