Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
m5l14i11 committed Aug 7, 2023
1 parent 6d5eaa7 commit 0644237
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ta_lib/indicators/volatility/src/atr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ pub fn atr(
let tr = true_range(high, low, close);

match smothing {
Some("SMMA") => smma(&tr, period),
Some("WMA") => wma(&tr, period),
Some("SMA") => sma(&tr, period),
Some("EMA") => ema(&tr, period),
_ => wma(&tr, period),
_ => smma(&tr, period),
}
}

Expand All @@ -30,7 +30,7 @@ mod tests {
let close = vec![1.5, 3.0, 4.5];
let period = 3;
let epsilon = 0.001;
let smothing = Some("SMMA");
let smothing = None;
let expected = vec![0.0, 0.8333, 1.5555];

let result: Vec<f64> = atr(&high, &low, &close, period, smothing).into();
Expand Down

0 comments on commit 0644237

Please sign in to comment.