pub fn accbands(
period: u32,
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
) -> (Vec<f64>, Vec<f64>, Vec<f64>, crate::TA_Integer) {
let mut outUpper: Vec<f64> = Vec::with_capacity(close.len());
let mut middleUpper: Vec<f64> = Vec::with_capacity(close.len());
let mut lowerUpper: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_ACCBANDS(
0, close.len() as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), period as i32, &mut out_begin, &mut out_size, outUpper.as_mut_ptr(), middleUpper.as_mut_ptr(),
lowerUpper.as_mut_ptr(),
);
match ret_code {
crate::TA_RetCode_TA_SUCCESS => outUpper.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(outUpper, middleUpper, lowerUpper, out_begin)
}
pub fn s_accbands(
period: u32,
high: &Vec<f32>,
low: &Vec<f32>,
close: &Vec<f32>,
) -> (Vec<f64>, Vec<f64>, Vec<f64>, crate::TA_Integer) {
let mut outUpper: Vec<f64> = Vec::with_capacity(close.len());
let mut middleUpper: Vec<f64> = Vec::with_capacity(close.len());
let mut lowerUpper: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_ACCBANDS(
0, close.len() as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), period as i32, &mut out_begin, &mut out_size, outUpper.as_mut_ptr(), middleUpper.as_mut_ptr(),
lowerUpper.as_mut_ptr(),
);
match ret_code {
crate::TA_RetCode_TA_SUCCESS => outUpper.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(outUpper, middleUpper, lowerUpper, out_begin)
}
pub fn acos(close: &Vec<f64>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_COS(
0, close.len() as i32 - 1, close.as_ptr(), &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_acos(close: &Vec<f32>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_COS(
0, close.len() as i32 - 1, close.as_ptr(), &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn ad(
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
volume: &Vec<f64>,
) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_AD(
0, close.len() as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), volume.as_ptr(), &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_ad(
high: &Vec<f32>,
low: &Vec<f32>,
close: &Vec<f32>,
volume: &Vec<f32>,
) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_AD(
0, close.len() as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), volume.as_ptr(), &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn add() {}
pub fn s_add() {}
pub fn adosc(
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
volume: &Vec<f64>,
fastperiod: i32,
slowperiod: i32,
) -> (Vec<f64>, crate::TA_Integer) {
let hlen = high.len();
if hlen.ne(&low.len()) || hlen.ne(&close.len()) || hlen.ne(&volume.len()) {
panic!("The length of input vectors are not equal, please double check the size of each.");
}
let mut out: Vec<f64> = Vec::with_capacity(hlen);
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_ADOSC(
0, hlen as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), volume.as_ptr(), fastperiod, slowperiod, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_adosc() {}
pub fn adx(
period: u32,
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_ADX(
0, close.len() as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_adx(
period: u32,
high: &Vec<f32>,
low: &Vec<f32>,
close: &Vec<f32>,
) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_ADX(
0, close.len() as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn adxr() {}
pub fn s_adxr() {}
pub fn apo(
close: &Vec<f64>,
fastperiod: i32,
slowperiod: i32,
matype: crate::TA_MAType,
) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_APO(
0, close.len() as i32 - 1, close.as_ptr(), fastperiod, slowperiod, matype, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_apo() {}
pub fn aroon() {}
pub fn s_aroon() {}
pub fn aroonosc(high: &Vec<f64>, low: &Vec<f64>, timeperiod: i32) -> (Vec<f64>, crate::TA_Integer) {
let hlen = high.len();
if hlen.ne(&low.len()) {
panic!("The length of input vectors are not equal, please double check the size of each.");
}
let mut out: Vec<f64> = Vec::with_capacity(hlen);
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_AROONOSC(
0, hlen as i32 - 1, high.as_ptr(), low.as_ptr(), timeperiod, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_aroonosc() {}
pub fn asin() {}
pub fn s_asin() {}
pub fn atan() {}
pub fn s_atan() {}
pub fn atr(
period: u32,
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_ATR(
0, close.len() as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_atr(
period: u32,
high: &Vec<f32>,
low: &Vec<f32>,
close: &Vec<f32>,
) -> (Vec<crate::TA_Real>, crate::TA_Integer) {
let mut out: Vec<crate::TA_Real> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_ATR(
0, close.len() as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn avgprice() {}
pub fn s_avgprice() {}
pub fn avgdev() {}
pub fn s_avgdev() {}
pub fn bbands(
period: u32,
in_real: &Vec<f64>,
in_db_dev_up: f64,
in_db_dev_down: f64,
in_ma_type: crate::TA_MAType,
) -> (Vec<f64>, Vec<f64>, Vec<f64>, crate::TA_Integer) {
let mut upper_band: Vec<crate::TA_Real> = Vec::with_capacity(in_real.len());
let mut middle_band: Vec<crate::TA_Real> = Vec::with_capacity(in_real.len());
let mut lower_band: Vec<crate::TA_Real> = Vec::with_capacity(in_real.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_BBANDS(
0, in_real.len() as i32 - 1, in_real.as_ptr(), period as i32, in_db_dev_up, in_db_dev_down, in_ma_type,
&mut out_begin, &mut out_size, upper_band.as_mut_ptr(), middle_band.as_mut_ptr(), lower_band.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
upper_band.set_len(out_size as usize);
middle_band.set_len(out_size as usize);
lower_band.set_len(out_size as usize);
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(upper_band, middle_band, lower_band, out_begin)
}
pub fn s_bbands(
period: u32,
in_real: &Vec<f32>,
in_db_dev_up: f64,
in_db_dev_down: f64,
in_ma_type: crate::TA_MAType,
) -> (Vec<f64>, Vec<f64>, Vec<f64>, crate::TA_Integer) {
let mut upper_band: Vec<crate::TA_Real> = Vec::with_capacity(in_real.len());
let mut middle_band: Vec<crate::TA_Real> = Vec::with_capacity(in_real.len());
let mut lower_band: Vec<crate::TA_Real> = Vec::with_capacity(in_real.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_BBANDS(
0, in_real.len() as i32 - 1, in_real.as_ptr(), period as i32, in_db_dev_up, in_db_dev_down, in_ma_type,
&mut out_begin, &mut out_size, upper_band.as_mut_ptr(), middle_band.as_mut_ptr(), lower_band.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
upper_band.set_len(out_size as usize);
middle_band.set_len(out_size as usize);
lower_band.set_len(out_size as usize);
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(upper_band, middle_band, lower_band, out_begin)
}
pub fn beta() {}
pub fn s_beta() {}
pub fn bop() {}
pub fn s_bop() {}
pub fn cci(
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
timeperiod: i32,
) -> (Vec<f64>, crate::TA_Integer) {
let clen = close.len();
if clen.ne(&high.len()) || clen.ne(&low.len()) {
panic!("The length of input vectors are not equal, please double check the size of each.");
}
let mut out: Vec<f64> = Vec::with_capacity(clen);
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_CCI(
0, clen as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), timeperiod, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_cci() {}
pub fn cdl2crows() {}
pub fn s_cdl2crows() {}
pub fn cdl3blackcrows() {}
pub fn s_cdl3blackcrows() {}
pub fn cdl3inside() {}
pub fn s_cdl3inside() {}
pub fn cdl3linestrike() {}
pub fn s_cdl3linestrike() {}
pub fn cdl3outside() {}
pub fn s_cdl3outside() {}
pub fn cdl3starsinsouth() {}
pub fn s_cdl3starsinsouth() {}
pub fn cdl3whitesoldiers() {}
pub fn s_cdl3whitesoldiers() {}
pub fn cdlabandonedbaby() {}
pub fn s_cdlabandonedbaby() {}
pub fn cdladvanceblock() {}
pub fn s_cdladvanceblock() {}
pub fn cdlbelthold() {}
pub fn s_cdlbelthold() {}
pub fn cdlbreakaway() {}
pub fn s_cdlbreakaway() {}
pub fn cdlclosingmarubozu() {}
pub fn s_cdlclosingmarubozu() {}
pub fn cdlconcealbabyswall() {}
pub fn s_cdlconcealbabyswall() {}
pub fn cdlcounterattack() {}
pub fn s_cdlcounterattack() {}
pub fn cdldarkcloudcover() {}
pub fn s_cdldarkcloudcover() {}
pub fn cdldoji() {}
pub fn s_cdldoji() {}
pub fn cdldojistar() {}
pub fn s_cdldojistar() {}
pub fn cdldragonflydoji() {}
pub fn s_cdldragonflydoji() {}
pub fn cdlengulfing() {}
pub fn s_cdlengulfing() {}
pub fn cdleveningdojistar() {}
pub fn s_cdleveningdojistar() {}
pub fn cdleveningstar() {}
pub fn s_cdleveningstar() {}
pub fn cdlgapsidesidewhite() {}
pub fn s_cdlgapsidesidewhite() {}
pub fn cdlgravestonedoji() {}
pub fn s_cdlgravestonedoji() {}
pub fn cdlhammer() {}
pub fn s_cdlhammer() {}
pub fn cdlhangingman() {}
pub fn s_cdlhangingman() {}
pub fn cdlharami() {}
pub fn s_cdlharami() {}
pub fn cdlharamicross() {}
pub fn s_cdlharamicross() {}
pub fn cdlhighwave() {}
pub fn s_cdlhighwave() {}
pub fn cdlhikkake() {}
pub fn s_cdlhikkake() {}
pub fn cdlhikkakemod() {}
pub fn s_cdlhikkakemod() {}
pub fn cdlhomingpigeon() {}
pub fn s_cdlhomingpigeon() {}
pub fn cdlidentical3crows() {}
pub fn s_cdlidentical3crows() {}
pub fn cdlinneck() {}
pub fn s_cdlinneck() {}
pub fn cdlinvertedhammer() {}
pub fn s_cdlinvertedhammer() {}
pub fn cdlkicking() {}
pub fn s_cdlkicking() {}
pub fn cdlkickingbylength() {}
pub fn s_cdlkickingbylength() {}
pub fn cdlladderbottom() {}
pub fn s_cdlladderbottom() {}
pub fn cdllongleggeddoji() {}
pub fn s_cdllongleggeddoji() {}
pub fn cdllongline() {}
pub fn s_cdllongline() {}
pub fn cdlmarubozu() {}
pub fn s_cdlmarubozu() {}
pub fn cdlmatchinglow() {}
pub fn s_cdlmatchinglow() {}
pub fn cdlmathold() {}
pub fn s_cdlmathold() {}
pub fn cdlmorningdojistar() {}
pub fn s_cdlmorningdojistar() {}
pub fn cdlmorningstar() {}
pub fn s_cdlmorningstar() {}
pub fn cdlonneck() {}
pub fn s_cdlonneck() {}
pub fn cdlpiercing() {}
pub fn s_cdlpiercing() {}
pub fn cdlrickshawman() {}
pub fn s_cdlrickshawman() {}
pub fn cdlrisefall3methods() {}
pub fn s_cdlrisefall3methods() {}
pub fn cdlseparatinglines() {}
pub fn s_cdlseparatinglines() {}
pub fn cdlshootingstar() {}
pub fn s_cdlshootingstar() {}
pub fn cdlshortline() {}
pub fn s_cdlshortline() {}
pub fn cdlspinningtop() {}
pub fn s_cdlspinningtop() {}
pub fn cdlstalledpattern() {}
pub fn s_cdlstalledpattern() {}
pub fn cdlsticksandwich() {}
pub fn s_cdlsticksandwich() {}
pub fn cdltakuri() {}
pub fn s_cdltakuri() {}
pub fn cdltasukigap() {}
pub fn s_cdltasukigap() {}
pub fn cdlthrusting() {}
pub fn s_cdlthrusting() {}
pub fn cdltristar() {}
pub fn s_cdltristar() {}
pub fn cdlunique3river() {}
pub fn s_cdlunique3river() {}
pub fn cdlupsidegap2crows() {}
pub fn s_cdlupsidegap2crows() {}
pub fn cdlxsidegap3methods() {}
pub fn s_cdlxsidegap3methods() {}
pub fn ceil() {}
pub fn s_ceil() {}
pub fn cmo() {}
pub fn s_cmo() {}
pub fn correl() {}
pub fn s_correl() {}
pub fn cos() {}
pub fn s_cos() {}
pub fn cosh() {}
pub fn s_cosh() {}
pub fn dema() {}
pub fn s_dema() {}
pub fn div() {}
pub fn s_div() {}
pub fn dx() {}
pub fn s_dx() {}
pub fn ema() {}
pub fn s_ema() {}
pub fn exp() {}
pub fn s_exp() {}
pub fn floor() {}
pub fn s_floor() {}
pub fn ht_dcperiod() {}
pub fn s_ht_dcperiod() {}
pub fn ht_dcphase() {}
pub fn s_ht_dcphase() {}
pub fn ht_phasor() {}
pub fn s_ht_phasor() {}
pub fn ht_sine() {}
pub fn s_ht_sine() {}
pub fn ht_trendline() {}
pub fn s_ht_trendline() {}
pub fn ht_trendmode() {}
pub fn s_ht_trendmode() {}
pub fn imi() {}
pub fn s_imi() {}
pub fn kama() {}
pub fn s_kama() {}
pub fn linearreg() {}
pub fn s_linearreg() {}
pub fn linearreg_angle() {}
pub fn s_linearreg_angle() {}
pub fn linearreg_intercept() {}
pub fn s_linearreg_intercept() {}
pub fn linearreg_slope() {}
pub fn s_linearreg_slope() {}
pub fn ln() {}
pub fn s_ln() {}
pub fn log10() {}
pub fn s_log10() {}
pub fn ma(
period: u32,
optInMAType: crate::TA_MAType,
close: &Vec<f64>,
) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_MA(
0, close.len() as i32 - 1, close.as_ptr(), period as i32, optInMAType,
&mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_ma(
period: u32,
optInMAType: crate::TA_MAType,
close: &Vec<f32>,
) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_MA(
0, close.len() as i32 - 1, close.as_ptr(), period as i32, optInMAType,
&mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn macd(
fast_period: u32,
slow_period: u32,
signal_period: u32,
close: &Vec<f64>,
) -> (Vec<f64>, Vec<f64>, Vec<f64>, crate::TA_Integer) {
let mut macd: Vec<f64> = Vec::with_capacity(close.len());
let mut macd_signal: Vec<f64> = Vec::with_capacity(close.len());
let mut macd_hist: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_MACD(
0, close.len() as i32 - 1, close.as_ptr(), fast_period as i32, slow_period as i32,
signal_period as i32,
&mut out_begin, &mut out_size, macd.as_mut_ptr(), macd_signal.as_mut_ptr(), macd_hist.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
macd.set_len(out_size as usize);
macd_signal.set_len(out_size as usize);
macd_hist.set_len(out_size as usize)
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(macd, macd_signal, macd_hist, out_begin)
}
pub fn s_macd(
fast_period: u32,
slow_period: u32,
signal_period: u32,
close: &Vec<f32>,
) -> (Vec<f64>, Vec<f64>, Vec<f64>, crate::TA_Integer) {
let mut macd: Vec<f64> = Vec::with_capacity(close.len());
let mut macd_signal: Vec<f64> = Vec::with_capacity(close.len());
let mut macd_hist: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_MACD(
0, close.len() as i32 - 1, close.as_ptr(), fast_period as i32, slow_period as i32,
signal_period as i32,
&mut out_begin, &mut out_size, macd.as_mut_ptr(), macd_signal.as_mut_ptr(), macd_hist.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
macd.set_len(out_size as usize);
macd_signal.set_len(out_size as usize);
macd_hist.set_len(out_size as usize)
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(macd, macd_signal, macd_hist, out_begin)
}
pub fn macdext() {}
pub fn s_macdext() {}
pub fn macdfix() {}
pub fn s_macdfix() {}
pub fn mama(
in_real: &Vec<f64>,
in_fast_limit: f64,
in_flow_limit: f64,
) -> (Vec<f64>, Vec<f64>, crate::TA_Integer) {
let mut mama: Vec<crate::TA_Real> = Vec::with_capacity(in_real.len());
let mut fama: Vec<crate::TA_Real> = Vec::with_capacity(in_real.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_MAMA(
0, in_real.len() as i32 - 1, in_real.as_ptr(), in_fast_limit, in_flow_limit, &mut out_begin, &mut out_size, mama.as_mut_ptr(), fama.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
mama.set_len(out_size as usize);
fama.set_len(out_size as usize);
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(mama, fama, out_begin)
}
pub fn s_mama(
in_real: &Vec<f32>,
in_fast_limit: f64,
in_flow_limit: f64,
) -> (Vec<f64>, Vec<f64>, crate::TA_Integer) {
let mut mama: Vec<crate::TA_Real> = Vec::with_capacity(in_real.len());
let mut fama: Vec<crate::TA_Real> = Vec::with_capacity(in_real.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_MAMA(
0, in_real.len() as i32 - 1, in_real.as_ptr(), in_fast_limit, in_flow_limit, &mut out_begin, &mut out_size, mama.as_mut_ptr(), fama.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
mama.set_len(out_size as usize);
fama.set_len(out_size as usize);
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(mama, fama, out_begin)
}
pub fn mavp() {}
pub fn s_mavp() {}
pub fn max() {}
pub fn s_max() {}
pub fn maxindex() {}
pub fn s_maxindex() {}
pub fn medprice() {}
pub fn s_medprice() {}
pub fn mfi(
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
volume: &Vec<f64>,
timeperiod: i32,
) -> (Vec<f64>, crate::TA_Integer) {
let clen = close.len();
if clen.ne(&high.len()) || clen.ne(&low.len()) || clen.ne(&volume.len()) {
panic!("The length of input vectors are not equal, please double check the size of each.");
}
let mut out: Vec<f64> = Vec::with_capacity(clen);
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_MFI(
0, clen as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), volume.as_ptr(), timeperiod, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_mfi() {}
pub fn midpoint() {}
pub fn s_midpoint() {}
pub fn midprice() {}
pub fn s_midprice() {}
pub fn min() {}
pub fn s_min() {}
pub fn minindex() {}
pub fn s_minindex() {}
pub fn minmax() {}
pub fn s_minmax() {}
pub fn minmaxindex() {}
pub fn s_minmaxindex() {}
pub fn minus_di() {}
pub fn s_minus_di() {}
pub fn minus_dm(period: u32, high: &Vec<f64>, low: &Vec<f64>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(high.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_MINUS_DM(
0, high.len() as i32 - 1, high.as_ptr(), low.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_minus_dm(period: u32, high: &Vec<f32>, low: &Vec<f32>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(high.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_MINUS_DM(
0, high.len() as i32 - 1, high.as_ptr(), low.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn mom() {}
pub fn s_mom() {}
pub fn mult() {}
pub fn s_mult() {}
pub fn natr(
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
timeperiod: i32,
) -> (Vec<f64>, crate::TA_Integer) {
let clen = close.len();
if clen.ne(&high.len()) || clen.ne(&low.len()) {
panic!("The length of input vectors are not equal, please double check the size of each.");
}
let mut out: Vec<f64> = Vec::with_capacity(clen);
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_NATR(
0, clen as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), timeperiod, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_natr() {}
pub fn obv(close: &Vec<f64>, volume: &Vec<f64>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_OBV(
0, close.len() as i32 - 1, close.as_ptr(), volume.as_ptr(),
&mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_obv(close: &Vec<f32>, volume: &Vec<f32>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_OBV(
0, close.len() as i32 - 1, close.as_ptr(), volume.as_ptr(),
&mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn plus_di() {}
pub fn s_plus_di() {}
pub fn plus_dm(period: u32, high: &Vec<f64>, low: &Vec<f64>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(high.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_PLUS_DM(
0, high.len() as i32 - 1, high.as_ptr(), low.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_plus_dm(period: u32, high: &Vec<f32>, low: &Vec<f32>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(high.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_PLUS_DM(
0, high.len() as i32 - 1, high.as_ptr(), low.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn ppo(
close: &Vec<f64>,
fastperiod: i32,
slowperiod: i32,
matype: crate::TA_MAType,
) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_PPO(
0, close.len() as i32 - 1, close.as_ptr(), fastperiod, slowperiod, matype, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_ppo() {}
pub fn roc() {}
pub fn s_roc() {}
pub fn rocp() {}
pub fn s_rocp() {}
pub fn rocr() {}
pub fn s_rocr() {}
pub fn rocr100() {}
pub fn s_rocr100() {}
pub fn rsi(
period: u32,
close_prices: &Vec<crate::TA_Real>,
) -> (Vec<crate::TA_Real>, crate::TA_Integer) {
let mut out: Vec<crate::TA_Real> = Vec::with_capacity(close_prices.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_RSI(
0, close_prices.len() as i32 - 1, close_prices.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_rsi(period: u32, close_prices: &Vec<f32>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close_prices.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_RSI(
0, close_prices.len() as i32 - 1, close_prices.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn sar() {}
pub fn s_sar() {}
pub fn sarext() {}
pub fn s_sarext() {}
pub fn sin() {}
pub fn s_sin() {}
pub fn sinh() {}
pub fn s_sinh() {}
pub fn sma(
period: u32,
close_prices: &Vec<crate::TA_Real>,
) -> (Vec<crate::TA_Real>, crate::TA_Integer) {
let mut out: Vec<crate::TA_Real> = Vec::with_capacity(close_prices.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_MA(
0, close_prices.len() as i32 - 1, close_prices.as_ptr(), period as i32, crate::TA_MAType_TA_MAType_SMA, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_sma(period: u32, close_prices: &Vec<f32>) -> (Vec<crate::TA_Real>, crate::TA_Integer) {
let mut out: Vec<crate::TA_Real> = Vec::with_capacity(close_prices.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_MA(
0, close_prices.len() as i32 - 1, close_prices.as_ptr(), period as i32, crate::TA_MAType_TA_MAType_SMA, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn sqrt() {}
pub fn s_sqrt() {}
pub fn stddev() {}
pub fn s_stddev() {}
#[allow(clippy::too_many_arguments)]
pub fn stoch(
fastk_period: u32,
slowk_period: u32,
optInSlowK_MAType: crate::TA_MAType,
slowd_period: u32,
optInSlowD_MAType: crate::TA_MAType,
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
) -> (Vec<f64>, Vec<f64>, crate::TA_Integer) {
let mut outSlowK: Vec<f64> = Vec::with_capacity(close.len());
let mut outSlowD: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_STOCH(
0, close.len() as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), fastk_period as i32, slowk_period as i32,
optInSlowK_MAType,
slowd_period as i32,
optInSlowD_MAType,
&mut out_begin, &mut out_size, outSlowK.as_mut_ptr(), outSlowD.as_mut_ptr(),
);
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
outSlowK.set_len(out_size as usize);
outSlowD.set_len(out_size as usize);
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(outSlowK, outSlowD, out_begin)
}
#[allow(clippy::too_many_arguments)]
pub fn s_stoch(
fastk_period: u32,
slowk_period: u32,
optInSlowK_MAType: crate::TA_MAType,
slowd_period: u32,
optInSlowD_MAType: crate::TA_MAType,
high: &Vec<f32>,
low: &Vec<f32>,
close: &Vec<f32>,
) -> (Vec<f64>, Vec<f64>, crate::TA_Integer) {
let mut outSlowK: Vec<f64> = Vec::with_capacity(close.len());
let mut outSlowD: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_STOCH(
0, close.len() as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), fastk_period as i32, slowk_period as i32,
optInSlowK_MAType,
slowd_period as i32,
optInSlowD_MAType,
&mut out_begin, &mut out_size, outSlowK.as_mut_ptr(), outSlowD.as_mut_ptr(),
);
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
outSlowK.set_len(out_size as usize);
outSlowD.set_len(out_size as usize);
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(outSlowK, outSlowD, out_begin)
}
pub fn stochf() {}
pub fn s_stochf() {}
pub fn stochrsi(
close: &Vec<f64>,
timeperiod: i32,
fastk_period: i32,
fastd_period: i32,
fastd_matype: crate::TA_MAType,
) -> (Vec<f64>, Vec<f64>, crate::TA_Integer) {
let clen = close.len();
let mut out_fastk: Vec<f64> = Vec::with_capacity(clen);
let mut out_fastd: Vec<f64> = Vec::with_capacity(clen);
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_STOCHRSI(
0, clen as i32 - 1, close.as_ptr(), timeperiod, fastk_period, fastd_period, fastd_matype,
&mut out_begin, &mut out_size, out_fastk.as_mut_ptr(), out_fastd.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
out_fastk.set_len(out_size as usize);
out_fastd.set_len(out_size as usize);
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out_fastk, out_fastd, out_begin)
}
pub fn s_stochrsi() {}
pub fn sub() {}
pub fn s_sub() {}
pub fn sum() {}
pub fn s_sum() {}
pub fn t3() {}
pub fn s_t3() {}
pub fn tan() {}
pub fn s_tan() {}
pub fn tanh() {}
pub fn s_tanh() {}
pub fn tema() {}
pub fn s_tema() {}
pub fn trange() {}
pub fn s_trange() {}
pub fn trima() {}
pub fn s_trima() {}
pub fn trix() {}
pub fn s_trix() {}
pub fn tsf() {}
pub fn s_tsf() {}
pub fn typprice() {}
pub fn s_typprice() {}
pub fn ultosc(
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
timeperiod1: i32,
timeperiod2: i32,
timeperiod3: i32,
) -> (Vec<f64>, crate::TA_Integer) {
let clen = close.len();
if clen.ne(&high.len()) || clen.ne(&low.len()) {
panic!("The length of input vectors are not equal, please double check the size of each.");
}
let mut out: Vec<f64> = Vec::with_capacity(clen);
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_ULTOSC(
0, clen as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), timeperiod1, timeperiod2, timeperiod3, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
out.set_len(out_size as usize);
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_ultosc(
high: &Vec<f32>,
low: &Vec<f32>,
close: &Vec<f32>,
timeperiod1: i32,
timeperiod2: i32,
timeperiod3: i32,
) -> (Vec<f64>, crate::TA_Integer) {
let clen = close.len();
if clen.ne(&high.len()) || clen.ne(&low.len()) {
panic!("The length of input vectors are not equal, please double check the size of each.");
}
let mut out: Vec<f64> = Vec::with_capacity(clen);
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_ULTOSC(
0, clen as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), timeperiod1, timeperiod2, timeperiod3, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => {
out.set_len(out_size as usize);
}
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn var() {}
pub fn s_var() {}
pub fn wclprice() {}
pub fn s_wclprice() {}
pub fn willr(
high: &Vec<f64>,
low: &Vec<f64>,
close: &Vec<f64>,
timeperiod: i32,
) -> (Vec<f64>, crate::TA_Integer) {
let clen = close.len();
if clen.ne(&high.len()) || clen.ne(&low.len()) {
panic!("The length of input vectors are not equal, please double check the size of each.");
}
let mut out: Vec<f64> = Vec::with_capacity(clen);
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_WILLR(
0, clen as i32 - 1, high.as_ptr(), low.as_ptr(), close.as_ptr(), timeperiod, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_willr() {}
pub fn wma(period: u32, close: &Vec<f64>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_WMA(
0, close.len() as i32 - 1, close.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}
pub fn s_wma(period: u32, close: &Vec<f32>) -> (Vec<f64>, crate::TA_Integer) {
let mut out: Vec<f64> = Vec::with_capacity(close.len());
let mut out_begin: crate::TA_Integer = 0;
let mut out_size: crate::TA_Integer = 0;
unsafe {
crate::TA_Initialize();
let ret_code = crate::TA_S_WMA(
0, close.len() as i32 - 1, close.as_ptr(), period as i32, &mut out_begin, &mut out_size, out.as_mut_ptr(), );
match ret_code {
crate::TA_RetCode_TA_SUCCESS => out.set_len(out_size as usize),
_ => panic!("Could not compute indicator, err: {:?}", ret_code),
}
crate::TA_Shutdown();
}
(out, out_begin)
}