joshuaulrich / TTR

Technical analysis and other functions to construct technical trading rules with R
GNU General Public License v2.0
330 stars 103 forks source link

TTR SMA n=1 bug #39

Closed siims-biz closed 4 years ago

siims-biz commented 7 years ago

Package TTR version 0.23-1

If I do SMA with n=1 then the first number gets replaced with NA Sample

kurs
[1] 1 2 3 4
> sma1 <- SMA(kurs,n=1)
> sma1
[1] NA  2  3  4

Expected result 1 2 3 4

> kurs <- ts(kurs)
> kurs
Time Series:
Start = 1 
End = 4 
Frequency = 1 
[1] 1 2 3 4
> sma1 <- SMA(kurs,n=1)
> sma1
Time Series:
Start = 1 
End = 4 
Frequency = 1 
[1] NA  2  3  4
joshuaulrich commented 4 years ago

This was fixed in 1daafa9fd5c15b12f1c11976b9acaa864b670348, which was released as part of version 0.23-5.