_TRO_Multi_Meter_DSR





//+------------------------------------------------------------------+ 
//|   _TRO_Multi_Meter_DSR                                           | 
//|                                                                  | 
//|   Copyright © 2007, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFT AND DONATIONS ACCEPTED                                    | 
//|                                                                  |
//|   therumpldone@gmail.com                                         |  
//+------------------------------------------------------------------+ 
//|                                                                  |
//| go to www.kreslik.com for the latest indicator updates           |  
//+------------------------------------------------------------------+ 
//|                                                                  |
//| Use www.efxgroup.com as your forex broker...                     |  
//| ...tell them therumpledone sent you!                             |  
//+------------------------------------------------------------------+ 

// thank you Xard777 from www.forex-tsd.com for showing me how to delete the objects properly.
// thank you mladen from www.forex-tsd.com for showing me I had a locals and global variables with same name 


#property indicator_chart_window

extern bool Show_Heading = false;
 
extern string IndName = "DSR" ; // change

extern bool Corner_of_Chart_RIGHT_TOP = true;

extern int Shift_UP_DN =15; 
extern int Adjust_Side_to_side  = 20; // 20

extern color BarLabel_color = LightBlue;
extern color CommentLabel_color = LightBlue;

extern color Sup_color = Lime;
extern color Eq_color = Yellow;
extern color Res_color = Red;
//******************* 
// change inputs for your indicator 
extern int       iPeriods=5; 


//*******************

string ObjHead01,ObjHead02,ObjHead03,ObjHead04,ObjHead05,ObjHead06,ObjHead07,ObjHead08,ObjHead09,ObjHead10,ObjHead11;  

string Obj0001,Obj0002,Obj0003,Obj0004,Obj0005,Obj0006,Obj0007,Obj0008,Obj0009,Obj0010,Obj0011;  



//+------------------------------------------------------------------+

int init()
  {
//---- 


//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {    
   //***********************************************************************************************************************

string LabelTime="";

if (LabelTime=="") {LabelTime=TimeToStr(TimeLocal(),TIME_SECONDS); }

   int    counted_bars=IndicatorCounted();
   
   
   ObjHead01 = "DSRColHead01" + LabelTime ; 
   ObjHead02 = "DSRColHead02" + LabelTime ; 
   ObjHead03 = "DSRColHead03" + LabelTime ; 
   ObjHead04 = "DSRColHead04" + LabelTime ; 
   ObjHead05 = "DSRColHead05" + LabelTime ; 
   ObjHead06 = "DSRColHead06" + LabelTime ; 
   ObjHead07 = "DSRColHead07" + LabelTime ; 
   ObjHead08 = "DSRColHead08" + LabelTime ; 
   ObjHead09 = "DSRColHead09" + LabelTime ; 
         
   string DSR_ObjHead01 ="M1 " ;
   string DSR_ObjHead02 ="M5  " ;     
   string DSR_ObjHead03 ="M15 " ;
   string DSR_ObjHead04 =" M30 " ;
   string DSR_ObjHead05 ="H1  " ;     
   string DSR_ObjHead06 ="H4  " ;
   string DSR_ObjHead07 ="D1  " ;
   string DSR_ObjHead08 ="W1  " ;
   string DSR_ObjHead09 ="MN1" ;   
   
   
        
    if (Corner_of_Chart_RIGHT_TOP == true)
    { int Col01x = 170+Adjust_Side_to_side ;                 
      int Col01y = 28+Shift_UP_DN ;
    }
    if (Corner_of_Chart_RIGHT_TOP == false)
   { Col01x = 159+Adjust_Side_to_side ;       
     Col01y = 24+Shift_UP_DN ;
    } 
    
   int ColAdj = -20 ; 
   int Col02x = Col01x + ColAdj ;   
   int Col03x = Col01x + ColAdj*2 ; 
   int Col04x = Col01x + ColAdj*3 ; 
   int Col05x = Col01x + ColAdj*4 ; 
   int Col06x = Col01x + ColAdj*5 ; 
   int Col07x = Col01x + ColAdj*6 ;    
   int Col08x = Col01x + ColAdj*7 ; 
   int Col09x = Col01x + ColAdj*8 ;     
   
   if ( Show_Heading) {        
   ObjectCreate(ObjHead01, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead01,DSR_ObjHead01 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead01, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead01, OBJPROP_XDISTANCE, Col01x);
   ObjectSet(ObjHead01, OBJPROP_YDISTANCE, Col01y); 

   ObjectCreate(ObjHead02, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead02,DSR_ObjHead02 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead02, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead02, OBJPROP_XDISTANCE, Col02x);
   ObjectSet(ObjHead02, OBJPROP_YDISTANCE, Col01y);   
       
   ObjectCreate(ObjHead03, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead03,DSR_ObjHead03 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead03, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead03, OBJPROP_XDISTANCE, Col03x);
   ObjectSet(ObjHead03, OBJPROP_YDISTANCE, Col01y); 
 
   ObjectCreate(ObjHead04, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead04,DSR_ObjHead04 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead04, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead04, OBJPROP_XDISTANCE, Col04x);
   ObjectSet(ObjHead04, OBJPROP_YDISTANCE, Col01y); 
   
   ObjectCreate(ObjHead05, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead05,DSR_ObjHead05 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead05, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead05, OBJPROP_XDISTANCE, Col05x);
   ObjectSet(ObjHead05, OBJPROP_YDISTANCE, Col01y); 
            
   ObjectCreate(ObjHead06, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead06,DSR_ObjHead06 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead06, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead06, OBJPROP_XDISTANCE, Col06x);
   ObjectSet(ObjHead06, OBJPROP_YDISTANCE, Col01y); 

   ObjectCreate(ObjHead07, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead07,DSR_ObjHead07 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead07, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead07, OBJPROP_XDISTANCE, Col07x);
   ObjectSet(ObjHead07, OBJPROP_YDISTANCE, Col01y); 
         
   ObjectCreate(ObjHead08, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead08,DSR_ObjHead08 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead08, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead08, OBJPROP_XDISTANCE, Col08x);
   ObjectSet(ObjHead08, OBJPROP_YDISTANCE, Col01y); 

   ObjectCreate(ObjHead09, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(ObjHead09,DSR_ObjHead09 , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(ObjHead09, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(ObjHead09, OBJPROP_XDISTANCE, Col09x);
   ObjectSet(ObjHead09, OBJPROP_YDISTANCE, Col01y); 
       
} // Show_Heading

 //*******************   change for  your indicator ********************
 
    
    string M1_DSR= "-",M5_DSR= "-", M15_DSR= "-", M30_DSR= "-", H1_DSR= "-", H4_DSR= "-", D1_DSR= "-",PRC1, W1_DSR= "-", MN1_DSR= "-";

    color  color_DSRm1,color_DSRm5,color_DSRm15,color_DSRm30,color_DSRH1,color_DSRH4,color_DSRD1,color_DSRW1,color_DSRMN1;     
         

   //DSR Signals


    double DSR_M1 = High[Highest(NULL,PERIOD_M1,MODE_HIGH,iPeriods,0)]; 
    double DSR_m1 = Low[Lowest(NULL,PERIOD_M1,MODE_LOW,iPeriods,0)]; 

    double DSR_M5 = High[Highest(NULL,PERIOD_M5,MODE_HIGH,iPeriods,0)]; 
    double DSR_m5 = Low[Lowest(NULL,PERIOD_M5,MODE_LOW,iPeriods,0)]; 

    double DSR_M15 = High[Highest(NULL,PERIOD_M15,MODE_HIGH,iPeriods,0)]; 
    double DSR_m15 = Low[Lowest(NULL,PERIOD_M15,MODE_LOW,iPeriods,0)]; 

    double DSR_M30 = High[Highest(NULL,PERIOD_M30,MODE_HIGH,iPeriods,0)]; 
    double DSR_m30 = Low[Lowest(NULL,PERIOD_M30,MODE_LOW,iPeriods,0)]; 

    double DSR_H1 = High[Highest(NULL,PERIOD_H1,MODE_HIGH,iPeriods,0)]; 
    double DSR_h1 = Low[Lowest(NULL,PERIOD_H1,MODE_LOW,iPeriods,0)]; 

    double DSR_H4 = High[Highest(NULL,PERIOD_H4,MODE_HIGH,iPeriods,0)]; 
    double DSR_h4 = Low[Lowest(NULL,PERIOD_H4,MODE_LOW,iPeriods,0)]; 

    double DSR_D1 = High[Highest(NULL,PERIOD_D1,MODE_HIGH,iPeriods,0)]; 
    double DSR_d1 = Low[Lowest(NULL,PERIOD_D1,MODE_LOW,iPeriods,0)]; 
    
    double DSR_W1 = High[Highest(NULL,PERIOD_W1,MODE_HIGH,iPeriods,0)]; 
    double DSR_w1 = Low[Lowest(NULL,PERIOD_W1,MODE_LOW,iPeriods,0)]; 
    
    double DSR_MN1 = High[Highest(NULL,PERIOD_MN1,MODE_HIGH,iPeriods,0)]; 
    double DSR_mn1 = Low[Lowest(NULL,PERIOD_MN1,MODE_LOW,iPeriods,0)]; 
    
 
   
    if (iClose(NULL,PERIOD_M1,0) == DSR_m1) color_DSRm1 = Sup_color; 
    else {
    if (iClose(NULL,PERIOD_M1,0) == DSR_M1) color_DSRm1 = Res_color; 
    else color_DSRm1 = Eq_color; }
    
    
    if ((iClose(NULL,PERIOD_M5,0) > DSR_M5) 
    &&  (iClose(NULL,PERIOD_M5,0) > DSR_m5)) color_DSRm5 = Sup_color; 
    else {
    if ((iClose(NULL,PERIOD_M5,0) < DSR_M5) 
    &&  (iClose(NULL,PERIOD_M5,0) < DSR_m5)) color_DSRm5 = Res_color; 
    else color_DSRm5 = Eq_color; }
        
    if ((iClose(NULL,PERIOD_M15,0) > DSR_M15) 
    &&  (iClose(NULL,PERIOD_M15,0) > DSR_m15)) color_DSRm15 = Sup_color; 
    else {
    if ((iClose(NULL,PERIOD_M15,0) < DSR_M15) 
    &&  (iClose(NULL,PERIOD_M15,0) < DSR_m15)) color_DSRm15 = Res_color; 
    else color_DSRm15 = Eq_color; }
    
    if ((iClose(NULL,PERIOD_M30,0) > DSR_M30) 
    &&  (iClose(NULL,PERIOD_M30,0) > DSR_m30)) color_DSRm30 = Sup_color; 
    else {
    if ((iClose(NULL,PERIOD_M30,0) < DSR_M30) 
    &&  (iClose(NULL,PERIOD_M30,0) < DSR_m30)) color_DSRm30 = Res_color; 
    else color_DSRm30 = Eq_color; }

    if ((iClose(NULL,PERIOD_H1,0) > DSR_H1) 
    &&  (iClose(NULL,PERIOD_H1,0) > DSR_h1)) color_DSRH1 = Sup_color; 
    else {
    if ((iClose(NULL,PERIOD_H1,0) < DSR_H1) 
    &&  (iClose(NULL,PERIOD_H1,0) < DSR_h1)) color_DSRH1 = Res_color; 
    else color_DSRH1 = Eq_color; }

    if ((iClose(NULL,PERIOD_H4,0) > DSR_H4) 
    &&  (iClose(NULL,PERIOD_H4,0) > DSR_h4)) color_DSRH4 = Sup_color; 
    else {
    if ((iClose(NULL,PERIOD_H4,0) < DSR_H4) 
    &&  (iClose(NULL,PERIOD_H4,0) < DSR_h4)) color_DSRH4 = Res_color; 
    else color_DSRH4 = Eq_color; }

    if ((iClose(NULL,PERIOD_D1,0) > DSR_D1) 
    &&  (iClose(NULL,PERIOD_D1,0) > DSR_d1)) color_DSRD1 = Sup_color; 
    else {
    if ((iClose(NULL,PERIOD_D1,0) < DSR_D1) 
    &&  (iClose(NULL,PERIOD_D1,0) < DSR_d1)) color_DSRD1 = Res_color; 
    else color_DSRD1 = Eq_color; }

    if ((iClose(NULL,PERIOD_W1,0) > DSR_W1) 
    &&  (iClose(NULL,PERIOD_W1,0) > DSR_w1)) color_DSRW1 = Sup_color; 
    else {
    if ((iClose(NULL,PERIOD_W1,0) < DSR_W1) 
    &&  (iClose(NULL,PERIOD_W1,0) < DSR_w1)) color_DSRW1 = Res_color; 
    else color_DSRW1 = Eq_color; }

    if ((iClose(NULL,PERIOD_MN1,0) > DSR_MN1) 
    &&  (iClose(NULL,PERIOD_MN1,0) > DSR_mn1)) color_DSRMN1 = Sup_color; 
    else {
    if ((iClose(NULL,PERIOD_MN1,0) < DSR_MN1) 
    &&  (iClose(NULL,PERIOD_MN1,0) < DSR_MN1)) color_DSRMN1 = Res_color; 
    else color_DSRMN1 = Eq_color; }

               
    
 //*******************          
    
    int Col00x = Col01x + 20 ;
    int Col00y = 50+Shift_UP_DN ;
    
    Col01y = 20+Shift_UP_DN ;
    
   Obj0002 = "SignalDSRM1t" + LabelTime ; 
           
           ObjectCreate(Obj0002, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0002,IndName, 7, "Tahoma Narrow",  BarLabel_color);  
   ObjectSet(Obj0002, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0002, OBJPROP_XDISTANCE, Col00x);
   ObjectSet(Obj0002, OBJPROP_YDISTANCE, Col00y);  // 50+Shift_UP_DN

   Obj0003 = "SignalDSRM1" + LabelTime ;        
           ObjectCreate(Obj0003, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0003, M1_DSR, 40, "Tahoma Narrow",  color_DSRm1);
   ObjectSet(Obj0003, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0003, OBJPROP_XDISTANCE, Col01x);
   ObjectSet(Obj0003, OBJPROP_YDISTANCE, Col01y); 

   Obj0004 = "SignalDSRM5" + LabelTime ;          
           ObjectCreate(Obj0004, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0004, M5_DSR, 40, "Tahoma Narrow",  color_DSRm5);
   ObjectSet(Obj0004, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0004, OBJPROP_XDISTANCE, Col02x);
   ObjectSet(Obj0004, OBJPROP_YDISTANCE, Col01y); 
      
   Obj0005 = "SignalDSRM15" + LabelTime ; 
   ObjectCreate(Obj0005, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0005, M15_DSR, 40, "Tahoma Narrow",  color_DSRm15);
   ObjectSet(Obj0005, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0005, OBJPROP_XDISTANCE, Col03x);
   ObjectSet(Obj0005, OBJPROP_YDISTANCE, Col01y); 
      
   Obj0006 = "SignalDSRM30" + LabelTime ; 
   ObjectCreate(Obj0006, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0006, M30_DSR, 40, "Tahoma Narrow",  color_DSRm30);
   ObjectSet(Obj0006, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0006, OBJPROP_XDISTANCE, Col04x);
   ObjectSet(Obj0006, OBJPROP_YDISTANCE, Col01y); 

   Obj0007 = "SignalDSRM60" + LabelTime ;      
           ObjectCreate(Obj0007, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0007, H1_DSR, 40, "Tahoma Narrow",  color_DSRH1);
   ObjectSet(Obj0007, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0007, OBJPROP_XDISTANCE, Col05x);
   ObjectSet(Obj0007, OBJPROP_YDISTANCE, Col01y); 

   Obj0008 = "SignalDSRM240" + LabelTime ;          
           ObjectCreate(Obj0008, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0008, H4_DSR, 40, "Tahoma Narrow",  color_DSRH4);
   ObjectSet(Obj0008, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0008, OBJPROP_XDISTANCE, Col06x);
   ObjectSet(Obj0008, OBJPROP_YDISTANCE, Col01y);

   Obj0009 = "SignalDSRM1440" + LabelTime ;    
           ObjectCreate(Obj0009, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0009, D1_DSR, 40, "Tahoma Narrow",  color_DSRD1);
   ObjectSet(Obj0009, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0009, OBJPROP_XDISTANCE, Col07x);
   ObjectSet(Obj0009, OBJPROP_YDISTANCE, Col01y);
   
   Obj0010 = "SignalDSRW1" + LabelTime ;    
           ObjectCreate(Obj0010, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0010, W1_DSR, 40, "Tahoma Narrow",  color_DSRW1);
   ObjectSet(Obj0010, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0010, OBJPROP_XDISTANCE, Col08x);
   ObjectSet(Obj0010, OBJPROP_YDISTANCE, Col01y);   
   
   Obj0011 = "SignalDSRMN1" + LabelTime ;    
           ObjectCreate(Obj0011, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0011, MN1_DSR, 40, "Tahoma Narrow",  color_DSRMN1);
   ObjectSet(Obj0011, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0011, OBJPROP_XDISTANCE, Col09x);
   ObjectSet(Obj0011, OBJPROP_YDISTANCE, Col01y); 
     
 //----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

ObjectsDeleteAll(0,OBJ_HLINE);
ObjectsDeleteAll(0,OBJ_TEXT);
ObjectsDeleteAll(0,OBJ_LABEL);
deleteObject(); 

//----
   return(0);
  }
  
void deleteObject()
  { 
//ObjectDelete(Obj0001);  
ObjectDelete(Obj0002); 
ObjectDelete(Obj0003); 
ObjectDelete(Obj0004); 
ObjectDelete(Obj0005); 
ObjectDelete(Obj0006); 
ObjectDelete(Obj0007); 
ObjectDelete(Obj0008); 
ObjectDelete(Obj0009); 
ObjectDelete(Obj0010); 
ObjectDelete(Obj0011); 

ObjectDelete(ObjHead01);  
ObjectDelete(ObjHead02); 
ObjectDelete(ObjHead03); 
ObjectDelete(ObjHead04); 
ObjectDelete(ObjHead05); 
ObjectDelete(ObjHead06); 
ObjectDelete(ObjHead07); 
ObjectDelete(ObjHead08); 
ObjectDelete(ObjHead09); 
 
  }



Sample





Analysis



Market Information Used:

Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains close prices for each bar


Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: