diff --git a/ta_lib/momentum/src/macd.rs b/ta_lib/momentum/src/macd.rs index 3c38fe3f..b0020268 100644 --- a/ta_lib/momentum/src/macd.rs +++ b/ta_lib/momentum/src/macd.rs @@ -12,7 +12,7 @@ pub fn macd( let macd_line = ema_fast .iter() .zip(&ema_slow) - .map(|(fast, slow)| match (fast, slow) { + .map(|(&fast, &slow)| match (fast, slow) { (Some(fast), Some(slow)) => Some(fast - slow), _ => None, }) @@ -29,7 +29,7 @@ pub fn macd( let histogram = macd_line .iter() .zip(&signal_line) - .map(|(macd, signal)| match (macd, signal) { + .map(|(&macd, &signal)| match (macd, signal) { (Some(macd), Some(signal)) => Some(macd - signal), _ => None, }) diff --git a/ta_lib/momentum/src/rsi.rs b/ta_lib/momentum/src/rsi.rs index 61a72524..a3fb1694 100644 --- a/ta_lib/momentum/src/rsi.rs +++ b/ta_lib/momentum/src/rsi.rs @@ -22,7 +22,7 @@ pub fn rsi(data: &[f64], period: usize) -> Vec> { let rsi = avg_gain .iter() - .zip(avg_loss.iter()) + .zip(&avg_loss) .map(|(&gain, &loss)| match (gain, loss) { (Some(gain), Some(loss)) if gain + loss > 0.0 => { let rs = gain / (loss + std::f64::EPSILON);