-
#property show_inputs input int i;// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. #property strict void Test() { double at[500]; PrintFormat("at[%d]",ArraySize(at)); // at[0] Print(at[10]); // array out of range in 'testscr.mq4' (10,13) ArraySetAsSeries(at,true); double ma = iMAOnArray(at,0,10,0,MODE_EMA,1); } void OnStart(){ Test(); }
Confirmed (build 1370). The array has zero size. - Commenting out the asSeries and onArray, it then has proper size.
In the last build use workaround please
Add fake global variable it will helps to keep array initializaed
#property show_inputs input int i;// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. #property strict int fake=1; void Test() { double at[500]; PrintFormat("at[%d]",ArraySize(at)); // at[0] Print(at[10]); // array out of range in 'testscr.mq4' (10,13) ArraySetAsSeries(at,true); double ma = iMAOnArray(at,0,10,0,MODE_EMA,1); } void OnStart(){ Test(); }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have tested simple code below and i got Array Out of Range Error.
but when i add one variable in global scope , the array ouf of range error is gone
I'm very curious what is the cause of this Array Out of Range Error?
Could anyone help to explain this problem please??