How do I use a for loop to check whether a condition has occurred, such as when the price has moved across the 20MA?