array function get "array out of range"

To add comments, please log in or register
chnp
149
chnp  

Please help. Thanks!

            double BandU[];
            double BandL[];
            for (int i=1;i<5;i++)
            {

            BandU[i] = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,i);
            BandL[i] = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,i);
            }

I want to caculate standard dev of Bands upper and lower lines. Thnaks.

Mladen Rakic
160869
Mladen Rakic  
chnp:

Please help. Thanks!

I want to caculate standard dev of Bands upper and lower lines. Thnaks.

To make it kind of inverted :  what is the size of your BandU and BandL arrays? As soon as you answer that question, you shall have an answer to an array out of range question too

chnp
149
chnp  
Mladen Rakic:

To make it kind of inverted :  what is the size of your BandU and BandL arrays? As soon as you answer that question, you shall have an answer to an array out of range question too

Thanks. I am a newbie. Do you mean using "ArrayResize"? I only need 4 numbers in the array. This still not working. Please help. Thanks!

            double BandU[];
            double BandL[];
            ArrayResize(BandU,4);
            ArrayResize(BandL,4);
            for (int i=1;i<5;i++)
            {

            BandU[i] = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,i);
            BandL[i] = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,i);
            }
            double stdbandsup = iStdDevOnArray(BandU,3,3,0,MODE_SMA,1);
            double stdbandslo = iStdDevOnArray(BandL,3,3,0,MODE_SMA,1);
            printf(stdbandsup+"   "+stdbandslo);
William Roeder
20250
William Roeder  
chnp: I am a newbie. Do you mean using "ArrayResize"? I only need 4 numbers in the array. This still not working. Please help. Thanks!
  1. Answer the previous question, and you would be half there.
  2. Of course it's still not working. What is the highest index you now store? Answer that question and you will know why.
To add comments, please log in or register