Tstar_vrb_cpp: Tstar index for Volume Runs Bars (bar_vrb)

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Tstar index for Volume Runs Bars (bar_vrb)

Usage

1
Tstar_vrb_cpp(b_t, v_t, v_0, w0, de, bkw_T, bkw_Pb1, bkw_V)

Arguments

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

Value

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

Examples

 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])
 

larryleihua/fmlr documentation built on Jan. 31, 2020, 8:55 a.m.