Download MetaTrader 5

"Array out of range" happening on blank line

To add comments, please log in or register
Spammermustdie
18
Spammermustdie  

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. 


Keith Watford
Moderator
8293
Keith Watford  
Make sure that you are checking the correct indicator, Indicator.mq5
Spammermustdie
18
Spammermustdie  
Keith Watford:
Make sure that you are checking the correct indicator, Indicator.mq5

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

Thanks. 

Keith Watford
Moderator
8293
Keith Watford  
Spammermustdie:

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

Thanks. 

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.

Mladen Rakic
71100
Mladen Rakic  
Spammermustdie:

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. 


That can happen if you use include file too ... check that
Spammermustdie
18
Spammermustdie  
Keith Watford:

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.

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. 

Alain Verleyen
Moderator
29866
Alain Verleyen  
Spammermustdie:

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. 


It IS a coding error. Check your code or post it if you want help.
Spammermustdie
18
Spammermustdie  
Mladen Rakic:
That can happen if you use include file too ... check that

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! 

To add comments, please log in or register