Closed dragie closed 3 years ago
Here's a reproducible example:
R> HMA(1:10, 2)
[1] NA NA 3.333333 4.333333 5.333333 6.333333 7.333333
[8] 8.333333 9.333333 10.333333
R> HMA(1:10, 3)
Error in WMA(x, n = n/2, ...) :
Length of 'wts' must equal the length of 'x' or 'n'
We need to truncate the value for n
in the first WMA()
call: WMA(x, n = trunc(n/2), ...)
hma <- function(data, n){ hmaout <- HMA(data, n ) }
when I call this function with n <- 3,5,7,9,11,etc it is not working, but it is working fine for even numbers like 2,4,6,8,10,etc