1 (edited by Hannes 2016-12-19 04:17:41)

Topic: "Array out of range"

As soon as I attach the following EA to a chart, it removes it instantaneously.

Screenshot: http://imgur.com/a/QFjj1

The log file says the following:

0    00:47:00.586    MaxMillion USDJPY USDJPY,H1: MaxMillion USDJPY loaded.
0    00:47:00.598    MaxMillion USDJPY USDJPY,H1: Loading data: USDJPY,H1, Minumum bars: 202...
1    00:47:00.599    MaxMillion USDJPY USDJPY,H1: array out of range in 'MaxMillion USDJPY.mq4' (1672,22)
3    00:47:00.599    MaxMillion USDJPY USDJPY,H1: not initialized
0    00:47:00.599    MaxMillion USDJPY USDJPY,H1: uninit reason 8
0    00:47:00.603    Expert MaxMillion USDJPY USDJPY,H1: removed
0    00:48:34.270    Expert MaxMillion USDJPY USDJPY,H1: loaded successfully

The following line causes the Exception (left loop in just for context):

for (int bar = 0; bar < firstBar; bar++)
        indComp.Value[bar] = 0; //this one

Could anyone help me? It would be quite the pain to look into it myself, as I have no idea how FSB structures its EAs code wise.

Post's attachments

MaxMillion USDJPY.mq4 351.49 kb, 1 downloads since 2016-12-19 

You don't have the permssions to download the attachments of this post.

Re: "Array out of range"

Thank you for the report.

This bug is fixed in FSB Pro v 3.8.1 with EA Code v41.

Please update FSB Pro (you can download the installer and run over your previous installation) and re-export the EA.

The core of the problem is wrong firstBar calculation in the "Average True Range" indicator.

You can also fix the bug manually in your EA:

Change line 2746 from

   int firstBar=period+period+2;


   int firstBar=period+previous+2;

Re: "Array out of range"

Thank you very much Popov.