"Array out of range" happening on blank line

Hello all,

I am facing strange “Array out of range” error. If any of you have experienced same issue, may I have some advice please?
“array out of range in ‘Indicator.mq5’(416, 32)”

This is the error message shown in MT5 terminal.

Do you suspect common stack overflow? No, it’s not…

Here are reasons why it is strange.

Line 416 is blank. So I cannot copy & paste code.
It happens only once or twice in a day. If it was coding error, it should happen every tick.
I added few dummy lines above line 416. Error still happens at (416, 32).
I added few dummy lines below line 416. Error still happens at (416, 32).
I deleted ex5 file then recompiled. No change.
I tried “#property strict”. No compile error happens.
Is there anything else I can try?
Thank you.

Make sure that you are checking the correct indicator, Indicator.mq5

I have a number of times been working on code and not understanding why it isn’t doing as I want and then found that I am working on a different version to the one actually on the chart.

It’s an easy mistake to make when you have more than 1 version.

“Indicator.mq5” is just an example. Actual file has unique name and I am sure that I am looking at same source code.


That can happen if you use include file too … check that

I fully understand what you are trying to say. Unfortunately, it isn’t the case.

As soon as I added “Print(“Help me!”);” under OnCalculate(), it immediately became effective.

So I am sure I am referring correct version.

It IS a coding error. Check your code or post it if you want help.

Ahhhhhh, this must be the reason.

As you assumed, there is an include file and there is complicated array handling on (416, 32).

Thank you very much for big hint!