enter image description hereit's tough trying to figure this out myself and I after a few hours I thought I'd ask for help:
I'm trying to do tick imbalance bars from 'Advances in Financial Machine Learning', using equations:
and either get E0[T] converging to 1 or the other term for calculating the threshold converging to 0/exploding.
Probably calculating them wrong. I've been staring at these pages for a few hours now and can't thigure it out, this is what I'm doing:
For E0[T] each time the threshold is reached, i calculate EWMA of all the T* (first one being arbitrarily set) and use that for the 'next' threshold.
For the other component, each time the threshold is reached, i calculate the absolute value of the EWMA of all the bt's up till now and use that for the 'next' threshold.
For EWMA i use a*x(t)+(1-a)*x(t-1).
Basically, mostly what happens is that the second term converges towards 0 as time goes by, forcing the whole threshold value down.
I honestly think, that if we're trying to get the same amount of information in each 'bucket', maybe the thereshold value should be stable over time, not dependant of observations? It's inevitable that unless there's a strong tred, the up/down probability is going to converge to zero... but the book can't be wrong, so it's got to work somehow.
Can anyone help?