Critical error Array out of range in EA

 

I am trying to create EA(MQL4) And Critical error Array out of range in EA error appeared. In fact, I'm trying to turn an indicator into an expert. I have done this before. But in this case, I encountered an error in the title. This problem occurred after adding void FindZones (). This part of the code works properly in the indicator. I think I made a mistake in rewriting the code that I did not realize that.

file attached. 

 
mahyar madani: I'm trying to turn an indicator into an expert

Don't try to do that. There are no buffers, no IndicatorCounted() or prev_calculated. No way to know if older bars have changed or been added (history update.)

Just get the value(s) of the indicator(s) into EA/indicator (using iCustom) and do what you want with it.

Reason: