Description Usage Arguments Value Examples
Tstar index for Volume Runs Bars (bar_vrb)
1 | Tstar_vrb_cpp(b_t, v_t, v_0, w0, de, bkw_T, bkw_Pb1, bkw_V)
|
b_t |
output of imbalance_tick(dat) with the data 'dat' has at least the following columns: Price |
v_t |
volume of the same data |
v_0 |
average volume 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 for exponentially weighted average T |
bkw_Pb1 |
backward window length for exponentially weighted average P[b_t=1] |
bkw_V |
backward window length for exponentially weighted average volumes |
a list of the following two vectors: a vector for the lengths of the tick imbalance bars. For example, if the return is c(10,26), then the 2 tick imbalance bars are (0,10] and (10, 36] a vector indicating up runs or down runs
1 2 3 4 5 6 7 8 9 10 | set.seed(1)
dat <- data.frame(Price = c(rep(0.5, 5), runif(100)), Size = runif(105, 10, 100))
b_t <- imbalance_tick(dat)
v_t <- dat$Size
T_vrb <- Tstar_vrb_cpp(b_t, v_t, 55, 10, 1.0, 10, 10, 10)
col <- ifelse(T_vrb$Type==1, "red", "blue")
T <- cumsum(T_vrb$Tstar)
plot(dat$Price)
for(i in 1:length(T)) abline(v = T[i], col = col[i])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.