Compute vertical barriers
add_vertical_barrier( t_events, close_date, num_days = 1, num_hours = 0, num_minutes = 0, num_seconds = 0 )
t_events | Filtered events (e.g. feom CUSUM filter) |
---|---|
close_date | Poxscit object of close vector or some other price vector |
num_days | Number of days into the future |
num_hours | Number of hours into the future |
num_minutes | Number of minutes into the future |
num_seconds | Number of seconds into the future |
data.table with 2 columns: t_events and vertical barrier
data("spy") cusum_events <- cusum_filter(subset(spy, select = c("index", "close")), 0.001) add_vertical_barrier(cusum_events, spy$index, num_days = 1)#> Datetime t1 #> 1: 2018-01-02 15:39:00 2018-01-03 15:39:00 #> 2: 2018-01-02 15:59:00 2018-01-03 15:59:00 #> 3: 2018-01-02 16:09:00 2018-01-03 16:09:00 #> 4: 2018-01-02 17:34:00 2018-01-03 17:34:00 #> 5: 2018-01-02 19:34:00 2018-01-03 19:34:00 #> --- #> 17766: 2020-12-30 17:09:00 2020-12-31 17:09:00 #> 17767: 2020-12-30 17:49:00 2020-12-31 17:49:00 #> 17768: 2020-12-30 20:04:00 2020-12-31 20:04:00 #> 17769: 2020-12-30 20:34:00 2020-12-31 20:34:00 #> 17770: 2020-12-30 21:44:00 2020-12-31 21:44:00