Skip to content

Commit

Permalink
cache len
Browse files Browse the repository at this point in the history
  • Loading branch information
m5l14i11 committed Jun 25, 2023
1 parent 48736e6 commit 1f2d1d8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ta_lib/overlap/src/vama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ pub fn vama(
) -> Vec<Option<f64>> {
let short_std = std_dev(close, short_volatility);
let long_std = std_dev(close, long_volatility);
let len = close.len();

let mut alpha = vec![None; close.len()];
let mut vama = vec![None; close.len()];
let mut alpha = vec![None; len];
let mut vama = vec![None; len];

for i in 0..close.len() {
for i in 0..len {
if let (Some(ss), Some(ls)) = (short_std[i], long_std[i]) {
alpha[i] = Some((ss / ls) * alpha_factor);
}
Expand Down

0 comments on commit 1f2d1d8

Please sign in to comment.