Is is not as simple as using >= instead of > comparisons. The functions would also need to look back further than just the previous bar.
Else, you cannot tell a peak from shoulder and you cannot tell a crossover from a touch.