Your algo strategy can assume that if the price of a given stock starts to increase (or fall) you chip-up (or chip-down). This rule can be programmed. If it works you leverage your position with a hope for higher gain. But let’s look at the same case scenario more from a statistical point of view which is also worth considering. This is a classical textbook example, often forgotten but useful in quick algo estimations.

Let’s say you have two limit orders outstanding on the same stock. One is placed at $\$21.50$ and the second at $\$21.00$. Knowing that probability that Order 1 executes (event A) is $p_1$ and that Order 2 executes (event B) is $p_2$, $p_1>p_2$, and orders’ execution will take place within the same time-frame, consider the following probabilities:

**Both or one of placed orders execute**

Given $P(A)=p_1$ and $P(B)=p_2$, and

$$

P(A|B) = 1

$$ which simply says that if $B$ occurs (prices passes through lower value upwards) at $p_1\ne 0$, the probability that Order 1 and 2 will be executed is:

$$

P(A\ \mbox{and}\ B) = P(A|B)P(B) = 1\times P(B) = p_2 \ .

$$ That leads us to the case of:

$$

P(A\ \mbox{or}\ B) = P(A)+P(B)-P(A\ \mbox{and}\ B) = p_1 + p_2 – p_2 = p_1 \ .

$$

**Order 2 executes given Order 1 executed**

If the price of the stock falls and crossed $\$21.50$, the probability that Order 2 (of lower price) will also execute can be estimated using the principals of probability. Knowing that $P(A\ \mbox{and}\ B)=P(A|B)P(B)$ we have:

$$

P(B\ \mbox{and}\ A) = P(B|A)P(A)

$$ and at $P(B\ \mbox{and}\ A) = P(A\ \mbox{and}\ B)$ what leads us to the solution:

$$

P(B|A) = \frac{P(B\ \mbox{and}\ A)}{P(A)} = \frac{p_2}{p_1} \ .

$$

**Remaining Practical Problem**

What is the best way to estimate $p_1$ and $p_2$ in any given trading conditions?