English

 36 nguye235 2014.10.15 17:10   Hello everyone,I tried to improvise the SuperSR 6 a little bit. However, when I insert my code, the Metatrader stop working. I struggle with this problem for a while now, yet no idea why. Please help me.Here is the part has error:```   double gap;    double contract=(Contract_Step + Precision) * Point;    int i=Bars;    int shift;    bool fractal;    double price;    int Rcount;    while(i>=0)      {       shift=i + Shift_Bars;       // Resistance       price=High[shift+3];       fractal=price>=High[shift+4] &&       price>=High[shift+5] &&       price > High[shift+2] &&       price > High[shift+1] &&       price > High[shift];       gap=v1[i+1] - price;       if (fractal && ((gap>=contract && Rcount >= 10) || gap < 0) )         {          if(gap>=contract)          {             v1[i]=price + (15 * Point);             Rcount=1;             r[i] = Rcount;          }          else          {//This is the source of error. I'm sure             for(int num_se_dot = Rcount; i + num_se_dot < Bars;num_se_dot += r[num_se_dot]) //r[] is the buffer contain the current # of dot of Resistance. Rcount is # of red dot right now. I'm sure those two work perfectly.             {                if(price >= v1[i + num_se_dot])                {                   break;                }                          }             v1[i]= v1[i + num_se_dot];             Rcount=1;             r[i] = 1;          } }``` Thank you guys.
 2034 gooly 2014.10.15 21:41 #   I think you have an endless loop:` while(i>=0) { .. }`where do you decrease i like i--;It might help if you put - if possible - i right behind while(i>=0) { i--;  //This works here as Bars-1 is the first baror use for(i=Bars-1;i>=0;i--){..}
 2034 gooly 2014.10.16 22:05 #   well you do```i=Bars; ... shift=i + Shift_Bars; .. shift + 3; // now you are no where, beyond Bars! the biggest accessible bar is Bars-1. ```