TTR_0.2 on CRAN

[This article was first published on FOSS Trading, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I am happy to announce a long-overdue update to the TTR package (version 0.2) is now on CRAN.

This update represents a major milestone, as TTR useRs are no longer restricted to using matrix objects. TTR 0.2 uses xts internally, so all major time series classes are now supported.


– Added the zig zag indicator: ZigZag()

– Added volatility estimators/indicators: volatility(), with the following calculations
– Close-to-Close
– Garman Klass
– Parkinson
– Rogers Satchell

– Added Money Flow Index: MFI()

– Added Donchian channel: DonchianChannel()


– All functions now use xts internally, adding support for all major time series classes. If try.xts() fails on the input object(s), they will be converted to a matrix and a matrix object will be returned.

– Added ‘bounded’ arg to stoch() and SMI(), which includes the current period in the calculation.

– Added naCheck() and implemented it in the moving average functions.

– Moved maType argument default values from function formals to function body for the following functions:
ADX, ATR, CCI, DPO, EMV, KST, MACD, RSI, TRIX, BBands, chaikinVolatility, stoch, SMI

– momentum() in CMO() no longer sets na=100

– Replaced ‘na’ argument in momentum() and ROC() with ‘na.pad’

– Added ‘multiple’ argument to TDI(), allowing more user control

– getYahooData() now returns an xts object

– Added colnames to output for ADX, EMV, and CLV (for xts)

– Added unit tests using the RUnit package
– Used checkEquals on object attributes as well as values

– Removed .First.lib function and added .onLoad with package version.


– Corrected NaN replacement in CLV()

– Corrected williamsAD(): AD=0 if C(t)=C(t-1)

– Corrected runMedian() and runMAD(). The argument controlling which type of median to calculate for even-numbered samples wasn’t being passed to the Fortran routine.

– aroon() calculation starts at period n+1, instead of n

– Added NA to first element of closeLag of ATR()

– Corrected BBands() and CCI() for rowMeans use on xts objects

– Made changes to Rd files to pass R CMD check on R-devel (2.9.0)

Please do contact me with any questions, concerns, bug reports, etc.

To leave a comment for the author, please follow the link and comment on their blog: FOSS Trading. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)