Tstar_trb_cpp: Tstar index for Tick Runs Bars (bar_trb)

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Tstar index for Tick Runs Bars (bar_trb)

Usage

1
Tstar_trb_cpp(b_t, w0, de, bkw_T, bkw_Pb1)

Arguments

b_t

output of imbalance_tick(dat) with the dat has at least the following columns: Price

w0

the expected time window length of the first bar

de

a positive value for adjusting the expected window size, that is, de*E0

bkw_T

backward window length for exponentially weighted average T

bkw_Pb1

backward window length for exponentially weighted average P[b_t=1]

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
set.seed(1)
dat <- data.frame(Price = c(rep(0.5, 5), runif(100)))
b_t <- imbalance_tick(dat)
T_trb <- Tstar_trb_cpp(b_t, 10, 1.0, 10, 10)
col <- ifelse(T_trb$Type==1, "red", "blue")
T <- cumsum(T_trb$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.