
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 2

#property  indicator_buffers 3
#property  indicator_color1  C'65,105,225'//RoyalBlue
#property indicator_width1 15
#property  indicator_color2  C'225,65,105'
#property indicator_width2 15
#property  indicator_color3  CLR_NONE
#property indicator_width3 15

extern int RSI=14;
extern int valeur1=55;
extern int valeur2=45;

bool     show_extra_digit  =  false;  
double      DecNos;

double   ExtBuffer1[];
double   ExtBuffer2[];
double   ExtBuffer3[];

double buffer_name, XARD;

color       color3            = White;
int         FontSize          =  11;
string      FontType          =  "Arial Black";
double      myPoint;
double      SetPoint() 



   { 
   double mPoint; 
   
   if (Digits < 4) 
   mPoint = 0.01; 
   else 
   mPoint = 0.0001; 
   
   return(mPoint); 
   }


int init()
  {
//---- drawing settings
   SetIndexStyle (0,DRAW_LINE);
   SetIndexBuffer(0,ExtBuffer1);//"RSI"+RSI +" is above 50");
   SetIndexStyle (1,DRAW_LINE);
   SetIndexBuffer(1,ExtBuffer2);//"RSI"+RSI +" is under 50");
   SetIndexStyle (2,DRAW_LINE);
   SetIndexBuffer(2,ExtBuffer3);//"RSI is in the mid zone ");
//---- names
   IndicatorShortName("");
   SetIndexLabel(0,NULL);
   SetIndexLabel(1,NULL);
   SetIndexLabel(2,NULL);
//---- initialization done
   buffer_name=XARD;
   

   myPoint = SetPoint();

   return(0);
  }



int deinit()
  {
//----
  ObjectDelete(buffer_name+"Panel01");
  ObjectDelete(buffer_name+"Panel02");
  ObjectDelete("RSI14");
  ObjectDelete("Spread");
  ObjectDelete("x2");
  ObjectDelete("x2b");
//----
   return(0);
  }



int start()
  {
   RefreshRates();

   if(show_extra_digit){int digit=1;int digitshift=-3;int digitshift1=-5;int digitshift2=3;int fontsize=4;int sprd=1;}
   else{ digitshift=0;digitshift1=0;digitshift2=0;fontsize=0;sprd=0;}

   if (StringFind (Symbol(), "JPY", 0) != -1){ DecNos = 2+digit;}
   else if(Symbol()=="XAUUSD" || Symbol()=="XAUUSDm"){ DecNos = 1+digit; }
   else if(Symbol()=="XAGUSD" || Symbol()=="XAGUSDm"){ DecNos = 2+digit; }
   else { DecNos = 4+digit; } 

   CreateFX3_Labels(buffer_name+"Panel01", 6, 1, "gg", 28, "Webdings", Gray);
   CreateFX3_Labels(buffer_name+"Panel02", 6,30, "gg", 28, "Webdings", Gray);
   
  
   double RSI14=iRSI(NULL,0,14,PRICE_CLOSE,0);
   CreateXX3_Labels( "RSI14",15,21);
   ObjectSetText("RSI14", "RSI: "+DoubleToStr(RSI14,0), FontSize, FontType, Black);

   double spread = (Ask-Bid)/myPoint;
   CreateXX3_Labels("Spread",11,7); 
   ObjectSetText("Spread", "SPD: "+DoubleToStr(spread,1), FontSize-1, FontType, Black);

//if (show.symbol.price) {   

   CreateXX3_Labels("x2", 10,34);
   ObjectSetText("x2",DoubleToStr(Bid,DecNos) , 14, "Arial Black", White);
   
   CreateXX3_Labels("x2b", 9,53);
   ObjectSetText("x2b",Symbol() , 12, "Arial Bold", Black);
    
//}   

   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;


   for(int i=0; i<limit; i++)
       if (iRSI(NULL,0,RSI,PRICE_CLOSE,i)<=valeur2) 
        {
        ExtBuffer2[i]=1;
        }
       else
       if (iRSI(NULL,0,RSI,PRICE_CLOSE,i)>=valeur1)
        {
        ExtBuffer1[i]=1;
        }
       else 
        ExtBuffer3[i]=1;
 
   return(0);
  }
  
  int CreateXX3_Labels( string c, int x2, int y2 ) {
   ObjectCreate( c, OBJ_LABEL,0, 0, 0 );
   ObjectSet( c, OBJPROP_CORNER, 2 );
   ObjectSet( c, OBJPROP_XDISTANCE,x2-6);
   ObjectSet( c, OBJPROP_YDISTANCE,y2-5);
   ObjectSet( c, OBJPROP_BACK, false );
   return(0);
   }
   
   int CreateFX3_Labels( string K, int x, int y, string Text, int AFontSize, string Font, color Color ) 
   {
   ObjectCreate( K, OBJ_LABEL, 0, 0, 0 );
   ObjectSet( K, OBJPROP_CORNER, 2);
   ObjectSet( K, OBJPROP_XDISTANCE,x-4);
   ObjectSet( K, OBJPROP_YDISTANCE,y);
   ObjectSet( K, OBJPROP_BACK, false );
   ObjectSetText(K, Text, AFontSize, Font, Color);
   return(0);
   }  
// ------------------------------------------------------------------------------------------ //
//                                     E N D   P R O G R A M                                  //
// ------------------------------------------------------------------------------------------ //
/*
                                                            
                                                          
                              ud$$$**$$$$$$$bc.                          
                          u@**"        4$$$$$$$Nu                       
                        J                ""#$$$$$$r                     
                       @                       $$$$b                    
                     .F                        ^*3$$$                   
                    :% 4                         J$$$N                  
                    $  :F                       :$$$$$                  
                   4F  9                       J$$$$$$$                 
                   4$   k             4$$$$bed$$$$$$$$$                 
                   $$r  'F            $$$$$$$$$$$$$$$$$r                
                   $$$   b.           $$$$$$$$$$$$$$$$$N                
                   $$$$$k 3eeed$$b    XARD777."$$$$$$$$$                
    .@$**N.        $$$$$" $$$$$$F'L $$$$$$$$$$$  $$$$$$$                
    :$$L  'L       $$$$$ 4$$$$$$  * $$$$$$$$$$F  $$$$$$F         edNc   
   @$$$$N  ^k      $$$$$  3$$$$*%   $F4$$$$$$$   $$$$$"        d"  z$N  
   $$$$$$   ^k     '$$$"   #$$$F   .$  $$$$$c.u@$$$          J"  @$$$$r 
   $$$$$$$b   *u    ^$L            $$  $$$$$$$$$$$$u@       $$  d$$$$$$ 
    ^$$$$$$.    "NL   "N. z@*     $$$  $$$$$$$$$$$$$P      $P  d$$$$$$$ 
       ^"*$$$$b   '*L   9$E      4$$$  d$$$$$$$$$$$"     d*   J$$$$$r   
            ^$$$$u  '$.  $$$L     "#" d$$$$$$".@$$    .@$"  z$$$$*"     
              ^$$$$. ^$N.3$$$       4u$$$$$$$ 4$$$  u$*" z$$$"          
                '*$$$$$$$$ *$b      J$$$$$$$b u$$P $"  d$$P             
                   #$$$$$$ 4$ 3*$"$*$ $"$'c@@$$$$ .u@$$$P               
                     "$$$$  ""F~$ $uNr$$$^&J$$$$F $$$$#                 
                       "$$    "$$$bd$.$W$$$$$$$$F $$"                   
                         ?k         ?$$$$$$$$$$$F'*                     
                          9$$bL     z$$$$$$$$$$$F                       
                           $$$$    $$$$$$$$$$$$$                        
                            '#$$c  '$$$$$$$$$"                          
                             .@"#$$$$$$$$$$$$b                          
                           z*      $$$$$$$$$$$$N.                       
                         e"      z$$"  #$$$k  '*$$.                     
                     .u*      u@$P"      '#$$c   "$$c                   
              u@$*"""       d$$"            "$$$u  ^*$$b.               
            :$F           J$P"                ^$$$c   '"$$$$$$bL        
           d$$  ..      @$#                      #$$b         '#$       
           9$$$$$$b   4$$                          ^$$k         '$      
            "$$6""$b u$$                             '$    d$$$$$P      
              '$F $$$$$"                              ^b  ^$$$$b$       
               '$W$$$$"                                'b@$$$$"         
                                                        ^$$$*  
*/            