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:

enter image description here enter image description here enter image description here

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?

  • 3
    $\begingroup$ Can you use Latex, for example \$ b_t = b_{t-1} \$ to make your maths more readable? $\endgroup$
    – nbbo2
    Apr 4, 2020 at 16:26
  • $\begingroup$ Done, pasted in photos of the formulas. $\endgroup$
    – the_dude
    Apr 4, 2020 at 16:35

1 Answer 1


I explored this topic some time ago and I wrote an informal review on Medium. You can find my article here.

In a few points:

  • Tick Imbalance bars are just the simplest application of information driven bars and we should build on that (rather than take its details too seriously) to uncover interesting insights. I believe Marcos Lopez De Prado has just showed us the way.
  • The proposed bar generating mechanism is heavily affected by how you initialize its parameters. In fact, to produce imbalance bars you must initialize the expected number of ticks per bar, the unconditional expectation of the tick sign and the alphas that define the two exponential averages used to update our expectations.
  • If you closely follow the suggested implementation, the amount of information we enclose in each bar and its dynamics are almost out of our control. And this is bad.
  • Other researchers (see this post) modified the suggested implementation either putting a cap to the expected number of ticks per bar or directly choosing a fixed imbalance threshold.

Hope this helps.

  • 1
    $\begingroup$ I've been racking my brain on this issue ever since I wrote this post, and my conclusions are the same as Yours. We'd ideally like to have the data be shaped by trading conditions instead of a rigid threshold, but the proposed implementation, to use the technical term, 'goes berserk' and a fixed T* value seems like a reasonable stop-gap solution that allows for some market impact on the threshold level (since probability is data-based) while preserving the intent of the whole exercise, which is to have each bar contain roughly the same amount of information as the last one. $\endgroup$
    – the_dude
    Apr 11, 2020 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.