# Tick Imbalance Bars - clarification on T index

I have been trying to learn quant related things on my own. I recently picked up a book called "Advances in Financial Machine Learning" by Marcos Lopez De Prado. I am having difficulty understanding some of the concepts in the book. I will explain whats written in the book followed my interpretation. Please let me know if I am right or wrong.

From textbook:

Consider a sequence of ticks {($$p_t,v_t$$)}$$_{t=1,..,T}$$, where $$p_t$$ is the price associated with t and $$v_t$$ is the volume associated with tick t. The so-called tick rule defines a sequence {$$b_t$$}$$_{t=1,...,T}$$ where

$$b_t=\begin{cases}b_{t-1}, & \text{if}\ \Delta p_t = 0 \\ \frac{|\Delta p_t|}{\Delta p_t} ,& \text{if} \Delta p_t \neq 0 \end{cases}---(1)$$

with $$b_t\in$${-1,1}, and the boundary condition $$b_0$$ is set to match the terminal value $$b_T$$ from the immediately preceding bar. The idea behind tick imbalance bars (TIBs) is to sample bars whenever tick imbalances exceed our expectations. We wish to determine the tick index, T, such that the accumulation of signed ticks (signed according to the tick rule) exceeds a given threshold. Next, let us discuss the procedure to determine T.

First we define the tick imbalance at time T as

$$\theta_T = \sum_{t = 1}^{T}b_t---(2)$$

Second, we compute the expected value of $$\theta_T$$ at the beginning of the bar,

$$E_o[T] = E_0[T](P[b_t = 1]-P[b_t = -1]---(3)$$,

where $$E_0[T]$$ is expected size of the tick bar,

$$P[b_t=1]$$ is the unconditional probability that a tick is classified as a buy,

$$P[b_t = -1]$$ is unconditional probability that a tick is classified as a sell.

Since $$P[b_t = 1] + P[b_t = -1] = 1$$, then $$E_0[\theta_T] = E_0[T](2P[b_t = 1] - 1)$$. In practice we can estimate $$E_0[T]$$ as an exponentially weighted moving average of T values from prior bars, and ($$2P[b_t = 1] - 1$$) as an exponentially weighted moving average of $$b_t$$ values from prior bars.

Third, we deine a tick imbalance bar (TIB) as a $$T^*$$ - contiguous subset of ticks such that the following condition is met:

$$T^* = \underset{T}{Argmin} (|\theta_T| \geq E_0[T]|2P[b_t = 1] - 1) ---(4)$$

Question/Clarification:

1. My understanding is that first we create $$b_t$$ matrix. Then we use equation (3) to understand the size of number of ticks in a bar (correct?)

2. $$E_0[T]$$ is exponentially weighted average of T, how do we calculate the first $$E_0[T]$$ when we dont have record of any previous T?

3. Similar to question 2, ($$2P[b_t = 1] - 1$$) how is the first weighted average of $$b_t$$ prior bar is cacluated?

I am trying to learn this on my own, I apologize in advance if I had made any mistakes or broke the community rules. If you can suggest me a place to learn these all, I would really appreciate it
{"ft_lang_label":"__label__en","ft_lang_prob":0.9048872,"math_prob":0.9998104,"size":2685,"snap":"2021-43-2021-49","text_gpt3_token_len":785,"char_repetition_ratio":0.100335695,"word_repetition_ratio":0.03982301,"special_character_ratio":0.3083799,"punctuation_ratio":0.09479554,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9999894,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-12-05T17:54:48Z\",\"WARC-Record-ID\":\"<urn:uuid:dcc0f64d-ee04-4fc7-8f49-a99451731a39>\",\"Content-Length\":\"135958\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ffd61288-c0a5-434b-b94f-38ede81683d1>\",\"WARC-Concurrent-To\":\"<urn:uuid:e7d70770-f46d-49fa-b5ba-dc7a88203ada>\",\"WARC-IP-Address\":\"151.101.129.69\",\"WARC-Target-URI\":\"https://quant.stackexchange.com/questions/44757/tick-imbalance-bars-clarification-on-t-index\",\"WARC-Payload-Digest\":\"sha1:5M6X22AN24TQGVW7WQHVQKNY3AUCPEQD\",\"WARC-Block-Digest\":\"sha1:6Q4QPOYCQLWGNJF2VJ57M72BOV5FBSO5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-49/CC-MAIN-2021-49_segments_1637964363215.8_warc_CC-MAIN-20211205160950-20211205190950-00288.warc.gz\"}"}