Non repainting super signal channel

 
//+------------------------------------------------------------------+
//|                                        super-signals-channel.mq4 |
//|                Copyright © 2006, Nick Bilak, beluck[AT]gmail.com |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2006, Nick Bilak"
#property link      "http://www.forex-tsd.com/"

// hacked into a channel ind. by t_david sometime in early 2007

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_width1 1
#property indicator_color2 Lime
#property indicator_width2 1
#property indicator_color3 Red
#property indicator_width3 1
#property indicator_color4 Lime
#property indicator_width4 1


extern int SignalGap = 4;
extern int ShowBars = 50;
extern int  BBPeriod=20;

int dist=24;
int Win = 0,Loss= 0;
double b1[];
double b2[];
double b3[];
double b4[];

int init()  {
   
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);   // 
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);  // cross
   SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,1);  // down arrow
   SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,1);  // up arrow
   
   SetIndexBuffer(0,b1);
   SetIndexBuffer(1,b2);  //
   SetIndexBuffer(2,b3);  // Down arrow
   SetIndexBuffer(3,b4);  // Up arrow
   
   
   SetIndexArrow(2,234);      // Down arrow   
   SetIndexArrow(3,233);      // Up arrow
 

   
   return(0);
}

int start() 
{
   
   int hhb,llb, count;
   
     
 
   for (count=0;count<500;count++) 
   {
      
      b1[count]=0; b2[count]=0; b3[count]=0; b4[count]=0;
  
     hhb = iHighest(Symbol(),0,MODE_HIGH,dist,count-dist/2);
     llb = iLowest(Symbol(),0,MODE_LOW,dist,count-dist/2);
    
     
      if ((count==hhb))
      {
       
       {
                    
                      
                         b3[count]= High[hhb]+SignalGap*Point;
                         if(((Open[count-1])) > ((Close[count-1])))  // GREEN Candlestick
                         {
                               Win++;
                             //  Print("SUPER SIGNAL CHANNELWin::",Win);
                         }
                         else 
                        {
                            Loss++;
                           // Print("SUPER SIGNAL CHANNEL Loss::",Loss);
                         }
                   }
         }
            
        
      if (count==llb)
      {
        
               {
               
                      b4[count]=Low[llb]-SignalGap*Point;
                       if(((Open[count-1]))< ((Close[count-1])))  // RED Candlestick
                       {
                           Win++;
                           Print("SUPER SIGNAL CHANNEL Win::",Win);
                        }
                       else 
                       {
                           Loss++;
                           Print("SUPER SIGNAL CHANNEL Loss::",Loss);
                          }
              } 
       }
    
         b1[count]=High[hhb];//+SignalGap*Point; //draws horiz line for sale (RED)
         b2[count]=Low[llb];//-SignalGap*Point;  //draws horiz line for buy (GREEN)
   
   }
   return(0);
}




How to convert this code into non repainting signals.

 PLEASE HELP!!!!!! :(
 
agritav:
How to convert this code into non repainting signals.

Usually, indicators redraw in order to hide its "UGLY pasts" - i.e. wrong signals.

For older bars that are in the chart's history, they resort to "looking ahead" (a.k.a cheating) in order to minimize such "UGLINESS".

So in general, it doesn't make sense to remove the redrawing of such indicators - it'll make them unbearably UGLY...

Just to give you an idea, this is what you get from this indicator, after I removed it's redraw (yellow line marks the difference between bars with redraw, and bars without redraw - to the right):


 

I think - those versions are not re-painted - 

----------------

Reason: