Wait for Indicator cross

 

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. 

 
variable are reset unless they are static or globally declared
Reason: