Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
m5l14i11 committed Jul 2, 2023
1 parent 13ed1b9 commit d05e9c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ta_lib/momentum/src/aosc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ mod tests {

#[test]
fn test_aosc() {
let high = &[3.0, 4.0, 5.0, 6.0, 7.0];
let low = &[1.0, 2.0, 3.0, 4.0, 5.0];
let hl2 = median_price(high, low);
let high = vec![3.0, 4.0, 5.0, 6.0, 7.0];
let low = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let hl2 = median_price(&high, &low);
let short_period = 2;
let long_period = 4;
let expected_result = vec![None, None, None, Some(1.0), Some(1.0)];
Expand Down
6 changes: 3 additions & 3 deletions ta_lib/utils/src/tr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ pub fn true_range(high: &[f64], low: &[f64], close: &[f64]) -> Vec<f64> {
high[i] - low[i]
} else {
f64::max(
high[i] - low[i],
f64::max(
f64::abs(high[i] - close[i - 1]),
f64::abs(low[i] - close[i - 1]),
high[i] - low[i],
f64::abs(high[i] - close[i - 1])
),
f64::abs(low[i] - close[i - 1]),
)
};

Expand Down

0 comments on commit d05e9c6

Please sign in to comment.