very weird error:"array out of range" on mql5 - page 2

 
Vladimir Karputov #:
Please, insert code correctly: when editing a post, click       and paste your code in the popup window 
sorry .Here you are
for(x=0; x < e; x++)
   {
      vect[x]=NormalizeDouble(2*WMA(x, MA_Period/2) - WMA(x, MA_Period),5);
      
      
   
         if(x==1517)
            Print("e-1:",(e-1)," x:",x," vect[1000]:",vect[1000],"  33333333333333");
      
         if(x==(e-1))
            Print("e-1:",(e-1)," x:",x," vect[1000]:",vect[1000],"  444444444444");
      
   }
sorry .here you are:
 
Yu Jia Zi Qu # :
sorry .Here you are sorry .here you are:

The error message tells you unequivocally: You are accessing an array index mindlessly. Why did you decide that the ' vect ' array has a size of at least '1001' elements?

 
Vladimir Karputov #:

The error message tells you unequivocally: You are accessing an array index mindlessly. Why did you decide that the ' vect ' array has a size of at least '1001' element

for(x=0; x < e; x++)
   {
      vect[x]=NormalizeDouble(2*WMA(x, MA_Period/2) - WMA(x, MA_Period),5);
      
      
   
         if(x==1517)
            Print("e-1:",(e-1)," x:",x," vect[1000]:",vect[1000]," arraySize: ",ArraySize(vect),"  33333333333333");
      
         if(x==(e-1))
            Print("e-1:",(e-1)," x:",x," vect[1000]:",vect[1000]," arraySize: ",ArraySize(vect),"  444444444444");
      
   }

Thanks.But the size of vect is 1518.Not 1001.As you can see on image bellow.

could you please download my total indicator(H-RSI-ver1). and test it on your system.

Files:
Untitled.png  16 kb
 
Yu Jia Zi Qu # :

Thanks.But the size of vect is 1518.Not 1001.As you can see on image bellow.

could you please download my total indicator(H-RSI-ver1). and test it on your system.

I am not a telepath: if there is no code, then there is no help.

 
Vladimir Karputov #:

I am not a telepath: if there is no code, then there is no help.

I put the total indicator code on first post.

 
Yu Jia Zi Qu # :

I put the total indicator code on first post.

You have an error (this is what catches your eye) - the interconnection of arrays is broken.

What you should do: create an indicator template using the MQL5 Wizard. Post here. Then it will move on.

 
Yu Jia Zi Qu #:

I really apreciate if you check again too. This is a really weird Problem

It is absolutely NOT a weird problem, it's a quite simple problem that you can easily correct yourself.

Debug ( https://www.mql5.com/en/articles/654 ) your code and check the size  of the array. It is set to Bars(_Symbol,PERIOD_CURRENT); what if this is less than 1000?

There is no error checking and some numbers are hard coded  - bad style causing such traps wasting a lot of your (and our) time.

Debugging MQL5 Programs
Debugging MQL5 Programs
  • www.mql5.com
This article is intended primarily for the programmers who have already learned the language but have not fully mastered the program development yet. It reveals some debugging techniques and presents a combined experience of the author and many other programmers.
 
hello here been having problem with making a deposit since yesterday simply because the sms is not popping on my phone . will be glad for any assistance  thanks 
 
100322916 emot patrick #:
hello here been having problem with making a deposit since yesterday simply because the sms is not popping on my phone . will be glad for any assistance  thanks 
What’s that got to do with arrays 
 
My error  still exist.So I appreciate if someone test my indicator (H-RSI-ver1.mq5) and tell me why I have error on line 133? but no error on line 130.
Reason: