DIGIRSI





//+------------------------------------------------------------------+
//|                                                      DIGIRSI.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
/*********************************************************************
* Author: Usen Iwinosa Osazeme
* Nick: FX Guru
*Cellfone No:07039377446
* Date: April 08, 2008
* Custom Indicator: Digirsi.mq4
* Version: 1.0.1
* Description: Multi TimeFrame Relative Strenght Index
*
* Version 1.0
* - Release Digirsi :)
**********************************************************************/
#property indicator_separate_window

extern int RSI_Period         =   14;
extern color Buy_Color        = Lime;
extern color Sell_Color       = Red;
extern color Overbought_Color = Green;
extern color Oversold_Color   = FireBrick;
extern bool Show_RSI_Value = true;
extern bool Show_Legend    =  true;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
IndicatorShortName ("DIGIRSI");

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
  ObjectsDeleteAll(0,OBJ_LABEL);
  
  ObjectDelete("ObjLabelA1"); ObjectDelete("ObjLabelB1"); ObjectDelete("ObjLabelC1"); ObjectDelete("ObjLabelD1");
   ObjectDelete("ObjLabelE1"); ObjectDelete("ObjLabelF1"); ObjectDelete("ObjLabelG1"); ObjectDelete("ObjLabelH1");
   ObjectDelete("ObjLabelI1"); ObjectDelete("ObjLabelJ1"); ObjectDelete("ObjLabelK1"); ObjectDelete("ObjLabelL1");
   ObjectDelete("ObjLabelIa1"); ObjectDelete("ObjLabelJa1"); ObjectDelete("ObjLabelKa1"); ObjectDelete("ObjLabelLa1");
   ObjectDelete("ObjLabelM1"); ObjectDelete("ObjLabelN1"); ObjectDelete("ObjLabelO1"); ObjectDelete("ObjLabelP1");
   ObjectDelete("ObjLabelMa1"); ObjectDelete("ObjLabelNa1"); ObjectDelete("ObjLabelOa1"); ObjectDelete("ObjLabelPa1");   
   ObjectDelete("SU1"); ObjectDelete("SV1"); ObjectDelete("SW1"); ObjectDelete("SX1"); ObjectDelete("SY1"); ObjectDelete("SZ1");
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  //m1 data
  double rsi_m1 = iRSI(NULL,PERIOD_M1,RSI_Period,PRICE_CLOSE,1);
  
  //m5 data
  double rsi_m5 = iRSI(NULL,PERIOD_M5,RSI_Period,PRICE_CLOSE,1);
  
  //m15 data
  double rsi_m15 = iRSI(NULL,PERIOD_M15,RSI_Period,PRICE_CLOSE,1);
  
  //m30 data
  double rsi_m30 = iRSI(NULL,PERIOD_M15,RSI_Period,PRICE_CLOSE,1);
  
  //h1 data
  double rsi_h1  = iRSI(NULL,PERIOD_H1,RSI_Period,PRICE_CLOSE,1);
  
  //h4 data
  double rsi_h4  = iRSI(NULL,PERIOD_H4,RSI_Period,PRICE_CLOSE,1);
  
  //define color
  color rsi_color_m1, rsi_color_m5, rsi_color_m15, rsi_color_m30, rsi_color_h1, rsi_color_h4;
  
  //define string    
    string rsi_level_m1, rsi_level_m5, rsi_level_m15, rsi_level_m30, rsi_level_h1, rsi_level_h4,
           rsi_arrow_m1, rsi_arrow_m5, rsi_arrow_m15, rsi_arrow_m30, rsi_arrow_h1, rsi_arrow_h4;
           
 //---m1 data
 
 //m1 buy
 if ((rsi_m1 > 50) && (rsi_m1 <= 70)) {rsi_color_m1 = Buy_Color;}
 
 //m1 sell
 if ((rsi_m1 < 50) && (rsi_m1 >= 30)) {rsi_color_m1 = Sell_Color;}
 
 //m1 overbought
 if ((rsi_m1 > 70) && (rsi_m1 != 100)) {rsi_color_m1 = Overbought_Color;}
 
 //m1 oversold
 if ((rsi_m1 < 30) && (rsi_m1 != 0))  {rsi_color_m1 = Oversold_Color;} 
 

 //--m5 data
 
 //m5 buy
 if ((rsi_m5 > 50) && (rsi_m5 <= 70))  {rsi_color_m5 = Buy_Color;}
 
 //m5 sell
 if ((rsi_m5 < 50) && (rsi_m5 >= 30))  {rsi_color_m5 = Sell_Color;}
 
 //m5 overbought
 if ((rsi_m5 > 70) && (rsi_m5 != 100)) {rsi_color_m5 = Overbought_Color;}
 
 //m5 oversold
 if ((rsi_m5 < 30) && (rsi_m5 != 0 ))  {rsi_color_m5 = Oversold_Color;}

 
 //--m15 data
 
 //m15 buy
 if ((rsi_m15 > 50) && (rsi_m15 <= 70))  {rsi_color_m15 = Buy_Color;}
 
 //m15 sell
 if ((rsi_m15 < 50) && (rsi_m15 >= 30))  {rsi_color_m15 = Sell_Color;}
 
 //m15 overbought
 if ((rsi_m15 > 70) && (rsi_m15 != 100)) {rsi_color_m15 = Overbought_Color;}
 
 //m15 oversold
 if ((rsi_m15 < 30) && (rsi_m15 != 0))  {rsi_color_m15 = Oversold_Color;}
 
 //--m30 data
 
 //m30 buy
 if ((rsi_m30 > 50) && (rsi_m30 <= 70))  {rsi_color_m30 = Buy_Color;}
 
 //m30 sell
 if ((rsi_m30 < 50) && (rsi_m30 >= 30))  {rsi_color_m30 = Sell_Color;}
 
 //m30 overbought
 if ((rsi_m30 > 70) && (rsi_m30 != 100)) {rsi_color_m30 = Overbought_Color;}
 
 //m30 oversold
 if ((rsi_m30 < 30) && (rsi_m30 != 0))  {rsi_color_m30 = Oversold_Color;}
 
 //--h1 data
 
 //h1 buy
 if ((rsi_h1 > 50) && (rsi_h1 <= 70))  {rsi_color_h1 = Buy_Color;}
 
 //h1 sell
 if ((rsi_h1 < 50) && (rsi_h1 >= 30)) {rsi_color_h1 = Sell_Color;}
 
 //h1 overbought
 if ((rsi_h1 > 70) && (rsi_h1 != 100)) {rsi_color_h1 = Overbought_Color;}
 
 //h1 oversold
 if ((rsi_h1 < 30) && (rsi_h1 != 0))  {rsi_color_h1 = Oversold_Color;}
 
 //--h4 data
 
 //h4 buy
 if ((rsi_h4 > 50) && (rsi_h4 <= 70)) {rsi_color_h4 = Buy_Color;}

 //h4 sell
 if ((rsi_h4 < 50) && (rsi_h4 >= 30)) {rsi_color_h4 = Sell_Color;}
 
 //h4 overbought
 if ((rsi_h1 > 70) && (rsi_h1 != 100))  {rsi_color_h4 = Overbought_Color;}
 
 //h4 oversold
 if ((rsi_h1 < 30) && (rsi_h1 != 0))   {rsi_color_h4 = Oversold_Color;}
 
 //Signal Labels           
    ObjectCreate("ObjLabelA1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0); //LABEL
        ObjectSetText("ObjLabelA1","SIGNAL",8, "Arial Bold", Silver);
        ObjectSet("ObjLabelA1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelA1", OBJPROP_XDISTANCE, 105);
        ObjectSet("ObjLabelA1", OBJPROP_YDISTANCE, 3);

    ObjectCreate("SU1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);//M1 SIGNAL
        ObjectSetText("SU1","M1",9, "Arial Bold", rsi_color_m1);
        ObjectSet("SU1", OBJPROP_CORNER, 0);
        ObjectSet("SU1", OBJPROP_XDISTANCE, 150);
        ObjectSet("SU1", OBJPROP_YDISTANCE, 3);
        
    ObjectCreate("SV1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);//M5 SIGNAL
        ObjectSetText("SV1","M5",9, "Arial Bold", rsi_color_m5);
        ObjectSet("SV1", OBJPROP_CORNER, 0);
        ObjectSet("SV1", OBJPROP_XDISTANCE, 175);
        ObjectSet("SV1", OBJPROP_YDISTANCE, 3);
        
    ObjectCreate("SW1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);//M15 SIGNAL
        ObjectSetText("SW1","M15",9, "Arial Bold", rsi_color_m15);
        ObjectSet("SW1", OBJPROP_CORNER, 0);
        ObjectSet("SW1", OBJPROP_XDISTANCE, 200);
        ObjectSet("SW1", OBJPROP_YDISTANCE, 3);
        
    ObjectCreate("SX1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);//M30 SIGNAL
        ObjectSetText("SX1","M30",9, "Arial Bold", rsi_color_m30);
        ObjectSet("SX1", OBJPROP_CORNER, 0);
        ObjectSet("SX1", OBJPROP_XDISTANCE, 230);
        ObjectSet("SX1", OBJPROP_YDISTANCE, 3);

    ObjectCreate("SY1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);//H1 SIGNAL
        ObjectSetText("SY1","H1",9, "Arial Bold", rsi_color_h1);
        ObjectSet("SY1", OBJPROP_CORNER, 0);
        ObjectSet("SY1", OBJPROP_XDISTANCE, 260);
        ObjectSet("SY1", OBJPROP_YDISTANCE, 3);             

    ObjectCreate("SZ1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);//H4 SIGNAL
        ObjectSetText("SZ1","H4",9, "Arial Bold", rsi_color_h4);
        ObjectSet("SZ1", OBJPROP_CORNER, 0);
        ObjectSet("SZ1", OBJPROP_XDISTANCE, 280);
        ObjectSet("SZ1", OBJPROP_YDISTANCE, 3);             

//Show Digital ADX Value
    if (Show_RSI_Value == true) 
    {
      //RSI value
      string rsi_m1_val = rsi_m1;
      string rsi_m5_val = rsi_m5;
      string rsi_m15_val =rsi_m15;
      string rsi_m30_val =rsi_m30;
      string rsi_h1_val = rsi_h1;
      string rsi_h4_val = rsi_h4;
    
      if (rsi_m1 > 50 && rsi_m1 <= 70) { rsi_arrow_m1 = "Ù"; }
      if (rsi_m1 < 50 && rsi_m1 >= 30) { rsi_arrow_m1 = "Ú"; }
      if (rsi_m1 > 70 && rsi_m1 != 100){ rsi_arrow_m1 = "Ù"; }
      if (rsi_m1 < 30 && rsi_m1 != 0)  { rsi_arrow_m1 = "Ú"; }

      if (rsi_m5 > 50 && rsi_m5 <= 70) { rsi_arrow_m5 = "Ù"; }
      if (rsi_m5 < 50 && rsi_m5 >= 30) { rsi_arrow_m5 = "Ú"; }
      if (rsi_m5 > 70 && rsi_m5 != 100){ rsi_arrow_m5 = "Ù"; }
      if (rsi_m5 < 30 && rsi_m5 != 0)  { rsi_arrow_m5 = "Ú"; }
      
      if (rsi_m15 > 50 && rsi_m15 <= 70) { rsi_arrow_m15 = "Ù"; }
      if (rsi_m15 < 50 && rsi_m15 >= 30) { rsi_arrow_m15 = "Ú"; }
      if (rsi_m15 > 70 && rsi_m15 != 100){ rsi_arrow_m15 = "Ù"; }
      if (rsi_m15 < 30 && rsi_m15 != 0)  { rsi_arrow_m15 = "Ú"; }

      if (rsi_m30 > 50 && rsi_m30 <= 70) { rsi_arrow_m30 = "Ù"; }
      if (rsi_m30 < 50 && rsi_m30 >= 30) { rsi_arrow_m30 = "Ú"; }
      if (rsi_m30 > 70 && rsi_m30!= 100) { rsi_arrow_m30 = "Ù"; }
      if (rsi_m30 < 30 && rsi_m30 != 0)  { rsi_arrow_m30 = "Ú"; }

      if (rsi_h1 > 50 && rsi_h1 <= 70) { rsi_arrow_h1 = "Ù"; }
      if (rsi_h1 < 50 && rsi_h1 >= 30) { rsi_arrow_h1 = "Ú"; }
      if (rsi_h1 > 70 && rsi_h1 != 100){ rsi_arrow_h1 = "Ù"; }
      if (rsi_m1 < 30 && rsi_h1 != 0)  { rsi_arrow_h1 = "Ú"; }

      if (rsi_h4 > 50 && rsi_h4 <= 70) { rsi_arrow_h4 = "Ù"; }
      if (rsi_h4 < 50 && rsi_h4 >= 30) { rsi_arrow_h4 = "Ú"; }
      if (rsi_h4 > 70 && rsi_h4 != 100){ rsi_arrow_h4 = "Ù"; }
      if (rsi_h4 < 30 && rsi_h4 != 0)  { rsi_arrow_h4 = "Ú"; }
      
       //RSI value
      ObjectCreate("ObjLabelO1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelO1","RSI",8, "Arial Bold", Silver);
        ObjectSet("ObjLabelO1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelO1", OBJPROP_XDISTANCE, 310);
        ObjectSet("ObjLabelO1", OBJPROP_YDISTANCE, 3);
            
      //RSI m1 value
      ObjectCreate("ObjLabelI1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelI1","M1  : "+StringSubstr(rsi_m1_val,0,5)+" ",8, "Arial Bold", rsi_color_m1);
        ObjectSet("ObjLabelI1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelI1", OBJPROP_XDISTANCE, 380);
        ObjectSet("ObjLabelI1", OBJPROP_YDISTANCE, 2);

      //arrow m1
      ObjectCreate("ObjLabelIa1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelIa1",rsi_arrow_m1,8, "Wingdings", rsi_color_m1);
        ObjectSet("ObjLabelIa1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelIa1", OBJPROP_XDISTANCE, 435);
        ObjectSet("ObjLabelIa1", OBJPROP_YDISTANCE, 3);
        
      //RSI m30 value
      ObjectCreate("ObjLabelJ1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelJ1","M30: "+StringSubstr(rsi_m30_val,0,5),8, "Arial Bold", rsi_color_m30);
        ObjectSet("ObjLabelJ1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelJ1", OBJPROP_XDISTANCE, 380);
        ObjectSet("ObjLabelJ1", OBJPROP_YDISTANCE, 12);

      //arrow m30
      ObjectCreate("ObjLabelJa1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelJa1",rsi_arrow_m30,8, "Wingdings", rsi_color_m30);
        ObjectSet("ObjLabelJa1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelJa1", OBJPROP_XDISTANCE, 435);
        ObjectSet("ObjLabelJa1", OBJPROP_YDISTANCE, 13);
    
      //RSI m5 value            
      ObjectCreate("ObjLabelK1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelK1","M5: "+StringSubstr(rsi_m5_val,0,5),8, "Arial Bold", rsi_color_m5);
        ObjectSet("ObjLabelK1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelK1", OBJPROP_XDISTANCE, 460);
        ObjectSet("ObjLabelK1", OBJPROP_YDISTANCE, 2);
        
      //arrow m5
      ObjectCreate("ObjLabelKa1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelKa1",rsi_arrow_m5,8, "Wingdings", rsi_color_m5);
        ObjectSet("ObjLabelKa1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelKa1", OBJPROP_XDISTANCE, 510);
        ObjectSet("ObjLabelKa1", OBJPROP_YDISTANCE, 3);        
        
      //RSI h1 value
      ObjectCreate("ObjLabelL1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelL1","H1 : "+StringSubstr(rsi_h1_val,0,5),8, "Arial Bold", rsi_color_h1);
        ObjectSet("ObjLabelL1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelL1", OBJPROP_XDISTANCE, 460);
        ObjectSet("ObjLabelL1", OBJPROP_YDISTANCE, 12);

      //arrow h1
      ObjectCreate("ObjLabelLa1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelLa1",rsi_arrow_h1,8, "Wingdings", rsi_color_h1);
        ObjectSet("ObjLabelLa1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelLa1", OBJPROP_XDISTANCE, 510);
        ObjectSet("ObjLabelLa1", OBJPROP_YDISTANCE, 13);        

      //RSI m15 value        
      ObjectCreate("ObjLabelM1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelM1","M15: "+StringSubstr(rsi_m15_val,0,5),8, "Arial Bold", rsi_color_m15);
        ObjectSet("ObjLabelM1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelM1", OBJPROP_XDISTANCE, 535);
        ObjectSet("ObjLabelM1", OBJPROP_YDISTANCE, 2);

      //arrow m15
      ObjectCreate("ObjLabelMa1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelMa1",rsi_arrow_m15,8, "Wingdings", rsi_color_m15);
        ObjectSet("ObjLabelMa1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelMa1", OBJPROP_XDISTANCE, 590);
        ObjectSet("ObjLabelMa1", OBJPROP_YDISTANCE, 3);        


      //RSI h4 value
      ObjectCreate("ObjLabelN1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelN1","H4   : "+StringSubstr(rsi_h4_val,0,5),8, "Arial Bold", rsi_color_h4);
        ObjectSet("ObjLabelN1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelN1", OBJPROP_XDISTANCE, 535);
        ObjectSet("ObjLabelN1", OBJPROP_YDISTANCE, 12);        
        
      //arrow h4
      ObjectCreate("ObjLabelNa1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelNa1",rsi_arrow_h4,8, "Wingdings", rsi_color_h4);
        ObjectSet("ObjLabelNa1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelNa1", OBJPROP_XDISTANCE, 590);
        ObjectSet("ObjLabelNa1", OBJPROP_YDISTANCE, 13); 
    }
 
  //Show Legend
    
    
     if (Show_Legend == true) 
    {
    ObjectCreate("ObjLabelB1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelB1","LEGEND",8, "Arial Bold", Silver);
        ObjectSet("ObjLabelB1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelB1", OBJPROP_XDISTANCE, 615);
        ObjectSet("ObjLabelB1", OBJPROP_YDISTANCE, 3);

    ObjectCreate("ObjLabelC1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelC1","* UPTREND",8, "Arial Bold",Buy_Color );
        ObjectSet("ObjLabelC1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelC1", OBJPROP_XDISTANCE, 665);
        ObjectSet("ObjLabelC1", OBJPROP_YDISTANCE, 2);   
        
    ObjectCreate("ObjLabelD1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelD1","* DNTREND",8, "Arial Bold",Sell_Color);
        ObjectSet("ObjLabelD1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelD1", OBJPROP_XDISTANCE, 665);
        ObjectSet("ObjLabelD1", OBJPROP_YDISTANCE, 14);       
        
    ObjectCreate("ObjLabelE1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelE1","* OVERBOUGHT",8, "Arial Bold",Overbought_Color );
        ObjectSet("ObjLabelE1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelE1", OBJPROP_XDISTANCE, 825);
        ObjectSet("ObjLabelE1", OBJPROP_YDISTANCE, 2);   
        
    ObjectCreate("ObjLabelF1", OBJ_LABEL, WindowFind("DIGIRSI"), 0, 0);
        ObjectSetText("ObjLabelF1","* OVERSOLD",8, "Arial Bold", Oversold_Color);
        ObjectSet("ObjLabelF1", OBJPROP_CORNER, 0);
        ObjectSet("ObjLabelF1", OBJPROP_XDISTANCE, 825);
        ObjectSet("ObjLabelF1", OBJPROP_YDISTANCE, 12);                           
        
    }
 int    counted_bars=IndicatorCounted();
//----
   
//----
   return(0);
  }



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:

Relative strength index


Custom Indicators Used:

Order Management characteristics:

Other Features: