Skip to contents

Wrapper around the function RegimeChange::detect_regimes() to create events for fgts_dygraph()

Usage

fg_RegimeChange(indta, usereturns = TRUE, series = NULL, ...)

Arguments

indta

Time series data.table with a date as the first column and a value series as the second column.

usereturns

(default TRUE) LOgical to take log returns before changepoint calculations.

series

Which series in indta to apply changepoints to

...

Parameters passed to RegimeChange::detect_regimes()

Value

data.table suitable for passing into fgts_dygraph() via the event_ds parameter

Details

Event Helpers : fg_RegimeChange https://cran.r-project.org/web/packages/RegimeChange/vignettes/introduction.html

Examples

if (requireNamespace("RegimeChange", quietly = TRUE)) {
dta <- tail(eqtypx[,.(date,QQQ,TLT)],260)
eventdt = fg_RegimeChange(dta)
fgts_dygraph(dta,event_ds=eventdt,title="With Breakouts")
}