Description Usage Arguments Value Author(s) Examples
Construct unit runs bars
1 2 3 4 5 6 7 8 9 10 | bar_unit_runs(
dat,
u_0 = 2000,
w0 = 10,
de = 1,
bkw_T = 5,
bkw_Pb1 = 5,
bkw_U = 5,
filter = FALSE
)
|
dat |
dat input with at least the following column: Price, Size |
u_0 |
average unit (volume*price) for each trade, and it is used to create the first bar |
w0 |
the expected time window length of the first bar |
de |
a positive value for adjusting the expected window size, that is, de*E0T; default: 1 |
bkw_T |
backward window length when using exponentially weighted average T |
bkw_Pb1 |
backward window length when using exponentially weighted average P[b_t=1] |
bkw_U |
backward window length for exponentially weighted average volumes |
filter |
whether used as a filter; default FALSE. If TRUE, then only i_feabar, the ending time index of feature bars, is returned |
If filter==FALSE, a list of vectors for tStamp (if returned), and HLOCV of volume runs bars. Note that the remaining data after the latest ending time point detected will be formed as a bar. If filter==TRUE, i_feabar a vector of integers for the time index.
Larry Lei Hua
1 2 3 4 | set.seed(1)
dat <- data.frame(Price = c(rep(0.5, 4), runif(50)), Size = floor(runif(54)*100))
bar_unit_runs(dat, u_0=mean(dat$Price)*mean(dat$Size))
bar_unit_runs(dat, u_0=mean(dat$Price)*mean(dat$Size), filter=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.