How can look back?
-
If I needed to look back and determine if say the last highest high formed before or after the last lowest low in x period, how would one code it?
-
So you have to determine the lowest low and then figure out where it is the previous and next low around it? I think we are going too deep here, an EA can check some basic things and do some basic calculations, but for special calculations they created indicators. So I can suggest to find some indicator.
By the way some people are working with ZigZag (I don't know why, I don't like it) and I added some calculations to get it's Xth top/low. Find it in the list of built in indicators. It is a custom indicator, but it comes with MT so it's almost built in