Download MetaTrader 5
To add comments, please log in or register
Deposit to your account via PayPal
Donald R Isbell Jr
276
Donald R Isbell Jr 2014.05.02 17:44 

Here is my code that worked before:

  At top of code: AsianStartBars[14]; AsianEndBars[14];
int k=0;
   while(k<14) {
      for(int j=AsianStartBar1;j<iBars(symbol,tf);j++) {
         if(TimeHour(iTime(symbol,tf,j)) == ChannelStartHour && TimeMinute(iTime(symbol,tf,j)) == 0) {
            AsianStartBars[k] = j;
            k++;
         }
      }
   }
   int n=0;
   while(n<14) {
      for(int m=AsianStartBar;m<iBars(symbol,tf);m++) {
         if(TimeHour(iTime(symbol,tf,m)) == ChannelEndHour && TimeMinute(iTime(symbol,tf,m)) == 0) {
            AsianEndBars[n] = m+1;
            n++;
         }
      }
   }

The problems are line:

AsianStartBars[k] = j;

AsianEndBars[n] = m+1;

I don't know how to fix it. If someone nows how, it's much appreciated. Thank you.

Kindest regards,

Don

Алексей Тарабанов
7220
Алексей Тарабанов 2014.05.02 18:15  
disbellj:

Here is my code that worked before:

The problems are line:

AsianStartBars[k] = j;

AsianEndBars[n] = m+1;

I don't know how to fix it. If someone nows how, it's much appreciated. Thank you.

Kindest regards,

Don


Do not modify external cyrcle before internal.
Donald R Isbell Jr
276
Donald R Isbell Jr 2014.05.02 18:53  

tara,

Thanks so much tara! You ROCK!

whroeder1
13596
whroeder1 2014.05.03 01:02  
   while(k<14) {
      for(int j=AsianStartBar1;j<iBars(symbol,tf);j++) {
         if(TimeHour(iTime(symbol,tf,j)) == ChannelStartHour && TimeMinute(iTime(symbol,tf,j)) == 0) {
            AsianStartBars[k] = j;
            k++;
         }
      }
   }
The while does NOTHING when you are inside the for.
// while(k<14) {
      for(int j=AsianStartBar1;j<iBars(symbol,tf);j++) {
         if(TimeHour(iTime(symbol,tf,j)) == ChannelStartHour && TimeMinute(iTime(symbol,tf,j)) == 0) {
            AsianStartBars[k] = j;
            k++; if(k >= 14) break;
         }
      }
// }
Donald R Isbell Jr
276
Donald R Isbell Jr 2014.05.16 11:12  

WHRoeder,

Thank you for the further explanation. Like I said, the code I posted worked before the upgrade to new MQL4 code. I have now updated my code. Same results as I get on pre-upgrade ex4. Thanks again. Maybe this will also help anyone else having the same issue.

Kindest regards,

Don

Ian Venner
2583
Ian Venner 2014.05.17 05:56  
I didnt work properly before the upgrade, MT4 just ignored the error and continued until it reached the end of the chart as defined by iBars() in the for loop. The new version generated the array error and quit the indicator when the code attempted to write to your array indexes [14] +
/
To add comments, please log in or register