forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Forum

Forex Software, Forex Strategies, Expert Advisors Generator

You are not logged in. Please login or register.


Forex Forum → Forex Strategy Builder Professional → Alligator Indicator -- array out of range in 'New Strategy.mq4'

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 7

Topic: Alligator Indicator -- array out of range in 'New Strategy.mq4'

Hello,

I encountered this error when attempting to back test in Strategy Tester.  This is a very simple strategy that uses a single indicator -- Alligator.  I've attached the corresponding *.XML

"New Strategy EURUSD,M5: array out of range in 'New Strategy.mq4' (2145,24)"


I've run into these 'array out of range' errors a few times with other indicators.  Usually I just hack the mql to get around it, but this time I thought I would ask for some help.  It is always a 'for' loop that causes the problem when initializing a couple of Value properties to '0'.  There is something wrong about parameter 'firstBar' that gets past into the method.

   for(int bar=0; bar<firstBar; bar++)
     {
      indCompLong.Value[bar]=0;
      indCompShort.Value[bar]=0;
     }

Later in the method there is another 'for' loop that performs the actual assignments.  So my hack is to substitute the second 'for' loop for the first one.  The second 'for' loop looks like this:
for(int bar=firstBar; bar<Data.Bars; bar++)

Appreciate any help.  Thanks.

Re: Alligator Indicator -- array out of range in 'New Strategy.mq4'

Sleytus, attach the strat!

Re: Alligator Indicator -- array out of range in 'New Strategy.mq4'

Please attach the strategy file.

Re: Alligator Indicator -- array out of range in 'New Strategy.mq4'

Sorry -- I used 'Choose File' but then didn't follow-up by pressing the 'Add File' button.  I think I got it this time.

Post's attachments

Array-Out-of-Range-Strategy.xml 12.21 kb, 2 downloads since 2017-04-09 

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

Re: Alligator Indicator -- array out of range in 'New Strategy.mq4'

I cannot reproduce the error. It works in my MT.

Re: Alligator Indicator -- array out of range in 'New Strategy.mq4'

Thanks for checking it out. 

I think it probably is data dependent.  Using my OANDA MT with broker data the error occurs.  However, using Metaquotes data the error does NOT occur.  I have seen similar "array out of range" errors before with other indicators, but only when using the OANDA MT with broker data.  Since I have accounts with several brokers and since I know how to work around it if it occurs with a strategy I really want to keep, then it really isn't a problem. 

Sorry for taking up your time on this one.

Re: Alligator Indicator -- array out of range in 'New Strategy.mq4'

Probably the EA cannot load enough bars on some reason. You can examine the case further if you want. If you find that there is in issue with the EA code we will try to fix it in order to prevent future similar cases.

Posts: 7

Pages 1

You must login or register to post a reply

Forex Forum → Forex Strategy Builder Professional → Alligator Indicator -- array out of range in 'New Strategy.mq4'

Similar topics in this forum