Skip to content

Commit

Permalink
keep refs
Browse files Browse the repository at this point in the history
  • Loading branch information
m5l14i11 committed Jun 30, 2023
1 parent 888a92d commit f34b893
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ta_lib/momentum/src/macd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand All @@ -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,
})
Expand Down
2 changes: 1 addition & 1 deletion ta_lib/momentum/src/rsi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn rsi(data: &[f64], period: usize) -> Vec<Option<f64>> {

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);
Expand Down

0 comments on commit f34b893

Please sign in to comment.