(high: &[f64], low: &[f64])
| 119 | } |
| 120 | |
| 121 | fn _get_gamma(high: &[f64], low: &[f64]) -> Vec<f64> { |
| 122 | let high_max = rolling_max(high, 2); |
| 123 | let low_min = rolling_min(low, 2); |
| 124 | high_max |
| 125 | .iter() |
| 126 | .zip(low_min.iter()) |
| 127 | .map( |
| 128 | |(h, l)| { |
| 129 | if h.is_nan() || l.is_nan() || *l == 0.0 { |
| 130 | NAN |
| 131 | } else { |
| 132 | (h / l).ln().powi(2) |
| 133 | } |
| 134 | }, |
| 135 | ) |
| 136 | .collect() |
| 137 | } |
| 138 | |
| 139 | fn _get_alpha(beta: &[f64], gamma: &[f64]) -> Vec<f64> { |
| 140 | let den = 3.0 - 2.0 * 2.0_f64.sqrt(); |
no test coverage detected