EATA repainter to non-repaint

1
Greetings,

long time reader, first time poster.

So i've been trying for some time to make the EATA indicator not to repaint, without success. I decided to ask about in the forum if some fellow coder can help identify what needs changing to oder to work. Im not sure i completely understand why the buffers get a different value each time the indicator is refreshed.

Running the EATA in the tester is intriguing, having a EA that enters a position based on EATA isnt *bad*, but as the lines are totaly different from where the EA entered a position, its hard to say.

Ill just post a quarter of the code here if maybe its indentifiable whats causing the repaint. If not, then theres the indicator in the attachment.

Code: Select all

int start() {
   
   int counted_bars = IndicatorCounted();

   if(counted_bars < 0){ 
      return(-1);
   }

   if(counted_bars > 0){
      counted_bars--;
   }
   
   int limit = MathMin(Bars - counted_bars, Bars - 1);
   
   for(int i = limit - 1 ; i >= 0; i--) {
   
      ttMaxBuffer[i] = EMPTY_VALUE;
      ttMinBuffer[i] = EMPTY_VALUE;
      CCIMapBuffer[i] = EMPTY_VALUE;
      RSIMapBuffer[i] = EMPTY_VALUE;
      arrowBuyBuffer[i] = EMPTY_VALUE;
      arrowSellBuffer[i] = EMPTY_VALUE;

      a = (iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i) - iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i));
      a1 = (iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i-1) - iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i+1));
      a2 = (iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i-2) - iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i+2));
      a3 = (iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i-3) - iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i+3));
      a4 = (iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i-4) - iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i+4));
      a5 = (iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i-5) - iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i+5));
      a6 = (iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i-6) - iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i+6));
      a7 = (iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i-7) - iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i+7));
      a8 = (iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i-8) - iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i+8));
      
      b = (iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i) - iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i));
      b1 = (iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i-1) - iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i+1));
      b2 = (iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i-2) - iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i+2));
      b3 = (iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i-3) - iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i+3));
      b4 = (iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i-4) - iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i+4));
      b5 = (iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i-5) - iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i+5));
      b6 = (iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i-6) - iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i+6));
      b7 = (iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i-7) - iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i+7));
      b8 = (iRSI(NULL, 0, RSI_per, PRICE_TYPICAL, i-8) - iCCI(NULL, 0, CCI_per, PRICE_TYPICAL, i+8));
      
      switch(koef) {
         case 1 :
            tt1max = a + a1;
            tt2min = b + b1;
            break;
         case 2 :
            tt1max = a + a1 + a2;
            tt2min = b + b1 + b2;
            break;
         case 3 :
            tt1max = a + a1 + a2 + a3;
            tt2min = b + b1 + b2 + b3;
            break;
         case 4 :
            tt1max = a + a1 + a2 + a3 + a4;
            tt2min = b + b1 + b2 + b3 + b4;
            break;
         case 5 :
            tt1max = a + a1 + a2 + a3 + a4 + a5;
            tt2min = b + b1 + b2 + b3 + b4 + b5;
            break;
         case 6 :
            tt1max = a + a1 + a2 + a3 + a4 + a5 + a6;
            tt2min = b + b1 + b2 + b3 + b4 + b5 + b6;
            break;
         case 7 :
            tt1max = a + a1 + a2 + a3 + a4 + a5 + a6 + a7;
            tt2min = b + b1 + b2 + b3 + b4 + b5 + b6 + b7;
            break;
         case 8 :
            tt1max = a + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8;
            tt2min = b + b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8;
            break;
         default :
            tt1max = a;
            tt2min = b;
      }
      
      ttMaxBuffer[i] = tt1max;
      ttMinBuffer[i] = tt2min;
      CCIMapBuffer[i] = iMAOnArray(ttMaxBuffer, Bars, Ma_Period, 0, MODE_SMA, i);
      RSIMapBuffer[i] = iMAOnArray(ttMinBuffer, Bars, Ma_Period, 0, MODE_SMA, i);
      
      if(arrows) {
         double arrowPosition = 0;
         if(CCIMapBuffer[i] >= RSIMapBuffer[i] && CCIMapBuffer[i+1] < RSIMapBuffer[i+1]) {
            DrawAr("up", i);
            arrowPosition = CCIMapBuffer[i];
            arrowBuyBuffer[i] = arrowPosition;
         }
         if(CCIMapBuffer[i] <= RSIMapBuffer[i] && CCIMapBuffer[i+1] > RSIMapBuffer[i+1]) {
            DrawAr("dn", i);
            arrowPosition = CCIMapBuffer[i];
            arrowSellBuffer[i] = arrowPosition;
         }
      }
                      
   }
}


Who is online

Users browsing this forum: No registered users and 16 guests