Download MetaTrader 5
To add comments, please log in or register
What are the latest MQL5.community news? The Wall section will tell you!
Boyan_K
24
Boyan_K 2015.03.13 09:26 

Hi There,

I am having an issue with arrays. I’m using this code as a part of my program

 

  PreviousUpTick = CurrentUpTick;
      CurrentUpTick = Ask;
   PreviousDnTick = CurrentDnTick;
      CurrentDnTick = Ask;
   
   if (CurrentUpTick < PreviousUpTick ) 
       DnTick[0]++;
   if (CurrentDnTick > PreviousDnTick ) 
       UpTick[0]--;
       Draw[0]= UpTick[0]+DnTick[0];

 

When using only this simple code to bump up or down a histogram it works well. Every array starts at value 0 and gets added or subtracted accordingly by 1 on every iteration. When I use this in another script that plots objects instead on a histogram the arrays are getting assigned EMPTY_VALUE, so it starts bumping up or down from 214783647 instead of 0 although I initialized all arrays with 0.

 

I would appreciate any help or clue.

Thanks. 

Keith Watford
Moderator
7987
Keith Watford 2015.03.13 09:39  
Are you talking about arrays or Buffers?
Carl Schreiber
5960
Carl Schreiber 2015.03.13 09:42  
EMPTY_VALUE = 214783647 while EMPTY = 0!
Boyan_K
24
Boyan_K 2015.03.13 10:02  
GumRai:
Are you talking about arrays or Buffers?

I'm talking abot buffers. Sorry for not being precise.

Keith Watford
Moderator
7987
Keith Watford 2015.03.13 10:55  
Boyan:

I'm talking abot buffers. Sorry for not being precise.

  

Use SetIndexEmptyValue and set it to zero
Boyan_K
24
Boyan_K 2015.03.13 11:36  
GumRai:
Use SetIndexEmptyValue and set it to zero

Yup, job done.

Thank you

whroeder1
13641
whroeder1 2015.03.13 12:12  
gooly: EMPTY_VALUE = 214783647 while EMPTY = 0!
EMPTY = -1
Carl Schreiber
5960
Carl Schreiber 2015.03.13 13:06  
ah, ok, haven't found it in the reference and it was what I remembered.
Boyan_K
24
Boyan_K 2015.03.13 13:12  

Thank you guys. U R awesome

/
To add comments, please log in or register