Download MetaTrader 5
To add comments, please log in or register
Publish your application in the Market - 7 million potential clients will see it
texoro
113
texoro 2016.06.15 17:01 

The code excerpt from where the error is this

 

   for (i = Bars; i >= 0; i--) {
      TrendUp[i] = EMPTY_VALUE;
      TrendDown[i] = EMPTY_VALUE;
      atr = iATR(NULL, 0, 10, i);
      medianPrice = (High[i]+Low[i])/2;
      up[i]=medianPrice+(Multiplier*atr);
      dn[i]=medianPrice-(Multiplier*atr);
      trend[i]=1;

The lines which gives the error are these
      TrendUp[i] = EMPTY_VALUE;
      TrendDown[i] = EMPTY_VALUE;"

 

Do you think why? then one thing is strange if I do run into a mql file with only the function code nn problems if I put it in a file with other code gives me the problem


I hope for an answer
Carl Schreiber
5954
Carl Schreiber 2016.06.15 18:27  
texcs:

The code excerpt from where the error is this

 

   for (i = Bars; i >= 0; i--) {
      TrendUp[i] = EMPTY_VALUE;
      TrendDown[i] = EMPTY_VALUE;
      atr = iATR(NULL, 0, 10, i);
      medianPrice = (High[i]+Low[i])/2;
      up[i]=medianPrice+(Multiplier*atr);
      dn[i]=medianPrice-(Multiplier*atr);
      trend[i]=1;

The lines which gives the error are these
      TrendUp[i] = EMPTY_VALUE;
      TrendDown[i] = EMPTY_VALUE;"

 

Do you think why? then one thing is strange if I do run into a mql file with only the function code nn problems if I put it in a file with other code gives me the problem


I hope for an answer

Have you checked the your access to your array, the size of the array?

PLS use the SRC-button if you post code!

whroeder1
13627
whroeder1 2016.06.16 11:43  
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. for (i = Bars; i >= 0; i--) {
          TrendUp[i] = EMPTY_VALUE;
    Assuming TrendUp is a buffer it's size is always Bars. That means the index is [Bars-1 .. 0], [Bars] does not exist, array out of range.
  3. Your lookback is 10 (iATR(NULL,0, 10, i) Do your lookbacks correctly.
/
To add comments, please log in or register