I have seen that the market will often test support/resistance levels 3 times before proceeding to the next level, I can’t work out the best way to keep track of the number of crosses (closes above/below?) in code, please help.
It could be any support/resistance level, such as a pivot, a moving average, a high/low, a round number, I think your code will work for them all, just modify the mm entry.