Computing the probability of observing 3 consecutive Up Ticks on trade tape where P(U)=0.51 and P(U | Prior Up)=0.64
Model short-term order book momentum and microstructure autocorrelation.
The question: Given P(Up Tick)=0.51 and P(Up Tick | Prior Up)=0.64, compute the probability of observing 3 consecutive Up Ticks on trade tape.
Code: https://github.com/dashn9/learning_quant/blob/main/src/lessons/order_flow_conditional_momentum.rs
Thought Mistakes
I didn't understand the problem enough, as usual. I aggressively tried to find P(U3 | prior U | U1), which was a problem because the question never said the third uptick was dependent on the last two; it said the last one.
Why P(A | B) = P(A ∩ B) / P(B) makes sense: P(A | B) basically asks the question, what are the odds, given B has happened, that A will happen, unlike P (A n B), which asks what the chance is that A and B will happen relative to the entire population. If you stop to think about it, you would notice P(B) is the only considered sample, so say P(A n B) in a sample is 5 and P(B) is 20; the odds become 0.25, unlike the original population say it’s 100; then it’s 5 relative to 100. You can see.
Say, for a given array of [U, U, U] in the sample. Based on what was asked, that is: the odds of P(U1 n U2 n U3).
U1 = [U1]
U2 = [U2]
U3 = [U3]
P(U2 n U1) = P(U1) * (PU2 | PU1) = 0.51 * 0.64 = 0.3261
P(U3 n U2 n U1) = P(U2 n U1) * P(U3 | U2 n U1) = 0.3261 * 0.64 = 0.208896
If you are wondering why the hell P(U3 | U2 n U1) = 0.64, that is because U3, as defined by the constraints of the problem, does not care about U1; really, it is more like P(U3 | U2). The statement said only: a tick has a 64% chance of being up if the prior one is up; hence why it is still 0.64.
Note: These are notes from my learning journey; please do not implement the strategy with real money unless you know what you are doing.