Download MetaTrader 5

Wait for Indicator cross

To add comments, please log in or register
Chris
65
Chris  

Hi,

 I'm really struggling with a what is most likely easy piece of code. I'm new to mql 4 so bear with me. 

 What I'm trying to achieve is this. Wait for the previous bar to close outside of the bollinger bands. Easy enough.

 What i'm struggling with is when this has been achieved I then need to wait for an oscillator to to drop below a line. This could be 5 bars in the future so I need the EA to only calculate the indicator on each new bar. How can I do this? If I have a return; in the code it goes back to the start and turns all my bools back to false. So its a never ending cycle of it turning true only to go back to false on the next iteration. 

whroeder1
16108
whroeder1  
variable are reset unless they are static or globally declared
To add comments, please log in or register