Back to Community
A Question on Mean Reversion

In a mean crossover strategy, the intent is to purchase the stock when the smaller day mean (lets say 'X') is greater that the larger day mean ('Y'). However, when an algorithm like this is run, it is very common to have 'poor' results early on, especially if the X>Y at the start. Hence, the algorithm will purchase the security NOT at the first crossover, but rather, it will purchase the stock immediately, how could one write an algorithm to only purchase the stock when the first crossover occurs. While naturally inclined to write a conditional, I fear this may results in the algorithm completely ignoring the crossover altogether, any tips? Thanks in advance!