//+------------------------------------------------------------------+
//|                                            Daily_Range_Stats.mq4 |
//|                                       Copyright @ Dariusz Surdel |
//|                                   http://www.Fx-NVATC.comeze.com |
//+------------------------------------------------------------------+
#property copyright "Copyright @ Dariusz Surdel"
#property link      "http://www.Fx-NVATC.comeze.com" 
#property indicator_chart_window


//Daily_Range_Stats section:
extern string Daily_Range_Stats__________ = "Daily Range Statistics parameters:" ;

extern int Which_Week_DR = 0;
extern bool Show_DR_Stats = true;
extern bool Is_Saturday_Candles = false;
extern bool Is_Sunday_Candles = true;
int  DR_Stats_DisplayCorner = 2;
int Last_Week_y  = 21;
int This_Week_y  = 9;
extern int Day_Label_x  = 270;
extern color DR_Stats_Color = Snow;
extern bool Show_DR_HL_Lines = true;
extern color DR_O_Line_Color = Blue;
extern int DR_O_Line_Style = 0;
extern int DR_O_Line_Width = 2;
extern color DR_H_Line_Color = OrangeRed;
extern int DR_H_Line_Style = 3;
extern int DR_H_Line_Width = 0;
extern color DR_L_Line_Color = LimeGreen;
extern int DR_L_Line_Style = 3;
extern int DR_L_Line_Width = 0;
extern bool DR_Lines_Ray = false;
extern bool DR_Lines_Back = true;
extern bool Show_Quadrant_Lines = true;
/* extern */ int Quadrant_Tf = 1440;
extern color Quad_H_Line_Color = OrangeRed;
extern int Quad_H_Line_Style = 0;
extern int Quad_H_Line_Width = 2;
extern color Quad_MH_Line_Color = OrangeRed;
extern int Quad_MH_Line_Style = 2;
extern int Quad_MH_Line_Width = 0;
extern color Quad_L_Line_Color = LimeGreen;
extern int Quad_L_Line_Style = 0;
extern int Quad_L_Line_Width = 2;
extern color Quad_ML_Line_Color = LimeGreen;
extern int Quad_ML_Line_Style = 2;
extern int Quad_ML_Line_Width = 0;
extern bool Quad_Lines_Ray = false;
extern bool Quad_Lines_Back = true;

double DR_Last_Mon,DR_Last_Tue,DR_Last_Wed,DR_Last_Thu,DR_Last_Fri,
       DR_This_Mon,DR_This_Tue,DR_This_Wed,DR_This_Thu,DR_This_Fri,
       WR_This_Week,WR_Last_Week,Factor,WADR_This_Week,WADR_Last_Week;
int    Mon_Shift,Tue_Shift,Wed_Shift,Thu_Shift,Fri_Shift,Spread;
string text,points;
//----

int init(){
  
// Daily Range Stats section:

if(Show_DR_Stats==true)
  {
  ObjectCreate("DR_Last_Mon", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_Last_Mon", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_Last_Mon", OBJPROP_XDISTANCE, Day_Label_x);
  ObjectSet("DR_Last_Mon", OBJPROP_YDISTANCE, Last_Week_y);
  
  ObjectCreate("DR_Last_Tue", OBJ_LABEL, 0, 0, 0);
  ObjectSet("DR_Last_Tue", OBJPROP_CORNER, DR_Stats_DisplayCorner);  // 
  ObjectSet("DR_Last_Tue", OBJPROP_XDISTANCE, Day_Label_x+50);
  ObjectSet("DR_Last_Tue", OBJPROP_YDISTANCE, Last_Week_y);
  
  ObjectCreate("DR_Last_Wed", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_Last_Wed", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_Last_Wed", OBJPROP_XDISTANCE, Day_Label_x+100);
  ObjectSet("DR_Last_Wed", OBJPROP_YDISTANCE, Last_Week_y);
  
  ObjectCreate("DR_Last_Thu", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_Last_Thu", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_Last_Thu", OBJPROP_XDISTANCE, Day_Label_x+150);
  ObjectSet("DR_Last_Thu", OBJPROP_YDISTANCE, Last_Week_y);
  
  ObjectCreate("DR_Last_Fri", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_Last_Fri", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_Last_Fri", OBJPROP_XDISTANCE, Day_Label_x+200);
  ObjectSet("DR_Last_Fri", OBJPROP_YDISTANCE, Last_Week_y);
   
  ObjectCreate("DR_This_Mon", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_This_Mon", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_This_Mon", OBJPROP_XDISTANCE, Day_Label_x);
  ObjectSet("DR_This_Mon", OBJPROP_YDISTANCE, This_Week_y);
  
  ObjectCreate("DR_This_Tue", OBJ_LABEL, 0, 0, 0);
  ObjectSet("DR_This_Tue", OBJPROP_CORNER, DR_Stats_DisplayCorner);  // 
  ObjectSet("DR_This_Tue", OBJPROP_XDISTANCE, Day_Label_x+50);
  ObjectSet("DR_This_Tue", OBJPROP_YDISTANCE, This_Week_y);
  
  ObjectCreate("DR_This_Wed", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_This_Wed", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_This_Wed", OBJPROP_XDISTANCE, Day_Label_x+100);
  ObjectSet("DR_This_Wed", OBJPROP_YDISTANCE, This_Week_y);
  
  ObjectCreate("DR_This_Thu", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_This_Thu", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_This_Thu", OBJPROP_XDISTANCE, Day_Label_x+150);
  ObjectSet("DR_This_Thu", OBJPROP_YDISTANCE, This_Week_y);
  
  ObjectCreate("DR_This_Fri", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_This_Fri", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_This_Fri", OBJPROP_XDISTANCE, Day_Label_x+200);
  ObjectSet("DR_This_Fri", OBJPROP_YDISTANCE, This_Week_y); 
  
  ObjectCreate("Monday", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Monday", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Monday", OBJPROP_XDISTANCE, Day_Label_x);
  ObjectSet("Monday", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Monday","Mon",9, "Berlin Sans FB", DR_Stats_Color);  
  
  ObjectCreate("Tuesday", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Tuesday", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Tuesday", OBJPROP_XDISTANCE, Day_Label_x+50);
  ObjectSet("Tuesday", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Tuesday","Tue",9, "Berlin Sans FB", DR_Stats_Color); 
  
  ObjectCreate("Wednesday", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Wednesday", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Wednesday", OBJPROP_XDISTANCE, Day_Label_x+100);
  ObjectSet("Wednesday", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Wednesday","Wed",9, "Berlin Sans FB", DR_Stats_Color);  
  
  ObjectCreate("Thursday", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Thursday", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Thursday", OBJPROP_XDISTANCE, Day_Label_x+150);
  ObjectSet("Thursday", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Thursday","Thu",9, "Berlin Sans FB", DR_Stats_Color);     

  ObjectCreate("Friday", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Friday", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Friday", OBJPROP_XDISTANCE, Day_Label_x+200);
  ObjectSet("Friday", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Friday","Fri",9, "Berlin Sans FB", DR_Stats_Color);
    
  ObjectCreate("Last", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Last", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Last", OBJPROP_XDISTANCE, Day_Label_x-72);
  ObjectSet("Last", OBJPROP_YDISTANCE, Last_Week_y); 
  ObjectSetText("Last","Last Week",9, "Berlin Sans FB", DR_Stats_Color);  
  
  ObjectCreate("This", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("This", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("This", OBJPROP_XDISTANCE, Day_Label_x-72);
  ObjectSet("This", OBJPROP_YDISTANCE, This_Week_y); 
  ObjectSetText("This","This Week",9, "Berlin Sans FB", DR_Stats_Color);  
  
  ObjectCreate("Daily Range", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Daily Range", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Daily Range", OBJPROP_XDISTANCE, Day_Label_x-72);
  ObjectSet("Daily Range", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Daily Range","Daily Range",9, "Berlin Sans FB", DR_Stats_Color); 
  
  ObjectCreate("Spread_", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Spread_", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Spread_", OBJPROP_XDISTANCE, Day_Label_x-72);
  ObjectSet("Spread_", OBJPROP_YDISTANCE, 54); 
  ObjectSetText("Spread_","Spread: ",9, "Berlin Sans FB", DR_Stats_Color);  
   
  ObjectCreate("WR_Last_Week", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("WR_Last_Week", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("WR_Last_Week", OBJPROP_XDISTANCE, Day_Label_x+250);
  ObjectSet("WR_Last_Week", OBJPROP_YDISTANCE, Last_Week_y); 
  
  ObjectCreate("WR_This_Week", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("WR_This_Week", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("WR_This_Week", OBJPROP_XDISTANCE, Day_Label_x+250);
  ObjectSet("WR_This_Week", OBJPROP_YDISTANCE, This_Week_y); 
  
  ObjectCreate("Weekly Range", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Weekly Range", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Weekly Range", OBJPROP_XDISTANCE, Day_Label_x+250);
  ObjectSet("Weekly Range", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Weekly Range","WSum",9, "Berlin Sans FB", DR_Stats_Color); 

  ObjectCreate("WADR_Last_Week", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("WADR_Last_Week", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("WADR_Last_Week", OBJPROP_XDISTANCE, Day_Label_x+300);
  ObjectSet("WADR_Last_Week", OBJPROP_YDISTANCE, Last_Week_y); 
  
  ObjectCreate("WADR_This_Week", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("WADR_This_Week", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("WADR_This_Week", OBJPROP_XDISTANCE, Day_Label_x+300);
  ObjectSet("WADR_This_Week", OBJPROP_YDISTANCE, This_Week_y); 
    
  ObjectCreate("Weekly ADR", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Weekly ADR", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Weekly ADR", OBJPROP_XDISTANCE, Day_Label_x+300);
  ObjectSet("Weekly ADR", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Weekly ADR","WADR",9, "Berlin Sans FB", DR_Stats_Color);
             /*  
               ObjectCreate("WHL",OBJ_ARROW,0,0,0);
               ObjectSet("WHL",OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
               ObjectSet("WHL",OBJPROP_COLOR,OrangeRed);
               ObjectSet("WHL",OBJPROP_WIDTH,1);
               ObjectSet("WHL",OBJPROP_BACK,false);  
               
               ObjectCreate("WLL",OBJ_ARROW,0,0,0);
               ObjectSet("WLL",OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
               ObjectSet("WLL",OBJPROP_COLOR,LimeGreen);
               ObjectSet("WLL",OBJPROP_WIDTH,1);  
               ObjectSet("WLL",OBJPROP_BACK,false);  
              */ 
               ObjectCreate("Daily_Open",OBJ_TREND,0,0,0);
               ObjectSet("Daily_Open",OBJPROP_COLOR,DR_O_Line_Color);
               ObjectSet("Daily_Open",OBJPROP_STYLE,DR_O_Line_Style);
               ObjectSet("Daily_Open",OBJPROP_WIDTH,DR_O_Line_Width);                
               ObjectSet("Daily_Open",OBJPROP_BACK,DR_Lines_Back);              
               ObjectSet("Daily_Open", OBJPROP_RAY, DR_Lines_Ray);
               
               ObjectCreate("DailyRange_Pot_High",OBJ_TREND,0,0,0);
               ObjectSet("DailyRange_Pot_High",OBJPROP_COLOR,DR_H_Line_Color);
               ObjectSet("DailyRange_Pot_High",OBJPROP_STYLE,DR_H_Line_Style);
               ObjectSet("DailyRange_Pot_High",OBJPROP_WIDTH,DR_H_Line_Width);                
               ObjectSet("DailyRange_Pot_High",OBJPROP_BACK,DR_Lines_Back); 
               ObjectSet("DailyRange_Pot_High", OBJPROP_RAY, DR_Lines_Ray);
               
               ObjectCreate("DailyRange_Pot_Low",OBJ_TREND,0,0,0);
               ObjectSet("DailyRange_Pot_Low",OBJPROP_COLOR,DR_L_Line_Color);
               ObjectSet("DailyRange_Pot_Low",OBJPROP_STYLE,DR_L_Line_Style);
               ObjectSet("DailyRange_Pot_Low",OBJPROP_WIDTH,DR_L_Line_Width);                
               ObjectSet("DailyRange_Pot_Low",OBJPROP_BACK,DR_Lines_Back); 
               ObjectSet("DailyRange_Pot_Low", OBJPROP_RAY, DR_Lines_Ray);
                              
               ObjectCreate("DR_Quadrant_Low",OBJ_TREND,0,0,0);
               ObjectSet("DR_Quadrant_Low",OBJPROP_COLOR,Quad_L_Line_Color);
               ObjectSet("DR_Quadrant_Low",OBJPROP_STYLE,Quad_L_Line_Style);
               ObjectSet("DR_Quadrant_Low",OBJPROP_WIDTH,Quad_L_Line_Width);                
               ObjectSet("DR_Quadrant_Low",OBJPROP_BACK,Quad_Lines_Back); 
               ObjectSet("DR_Quadrant_Low", OBJPROP_RAY, Quad_Lines_Ray);
                              
               ObjectCreate("DR_Quadrant_Mid_Low",OBJ_TREND,0,0,0);
               ObjectSet("DR_Quadrant_Mid_Low",OBJPROP_COLOR,Quad_ML_Line_Color);
               ObjectSet("DR_Quadrant_Mid_Low",OBJPROP_STYLE,Quad_ML_Line_Style);
               ObjectSet("DR_Quadrant_Mid_Low",OBJPROP_WIDTH,Quad_ML_Line_Width);                
               ObjectSet("DR_Quadrant_Mid_Low",OBJPROP_BACK,Quad_Lines_Back);  
               ObjectSet("DR_Quadrant_Mid_Low", OBJPROP_RAY, Quad_Lines_Ray);
                              
               ObjectCreate("DR_DR_Quadrant_High",OBJ_TREND,0,0,0);
               ObjectSet("DR_Quadrant_High",OBJPROP_COLOR,Quad_H_Line_Color);
               ObjectSet("DR_Quadrant_High",OBJPROP_STYLE,Quad_H_Line_Style);
               ObjectSet("DR_Quadrant_High",OBJPROP_WIDTH,Quad_H_Line_Width);                
               ObjectSet("DR_Quadrant_High",OBJPROP_BACK,Quad_Lines_Back); 
               ObjectSet("DR_Quadrant_High", OBJPROP_RAY, Quad_Lines_Ray);
                              
               ObjectCreate("DR_Quadrant_Mid_High",OBJ_TREND,0,0,0);
               ObjectSet("DR_Quadrant_Mid_High",OBJPROP_COLOR,Quad_MH_Line_Color);
               ObjectSet("DR_Quadrant_Mid_High",OBJPROP_STYLE,Quad_MH_Line_Style);
               ObjectSet("DR_Quadrant_Mid_High",OBJPROP_WIDTH,Quad_MH_Line_Width);                
               ObjectSet("DR_Quadrant_Mid_High",OBJPROP_BACK,Quad_Lines_Back);                               
               ObjectSet("DR_Quadrant_Mid_High", OBJPROP_RAY, Quad_Lines_Ray); 
  }   
//----        
  return(0);

}

int deinit(){
 // Daily Range Stats section:
  ObjectDelete("DR_This_Mon");
  ObjectDelete("DR_This_Tue");
  ObjectDelete("DR_This_Wed");
  ObjectDelete("DR_This_Thu");
  ObjectDelete("DR_This_Fri");
  ObjectDelete("DR_Last_Mon");
  ObjectDelete("DR_Last_Tue");
  ObjectDelete("DR_Last_Wed");
  ObjectDelete("DR_Last_Thu");
  ObjectDelete("DR_Last_Fri");
  ObjectDelete("Monday");
  ObjectDelete("Tuesday");
  ObjectDelete("Wednesday");
  ObjectDelete("Thursday");
  ObjectDelete("Friday");
  ObjectDelete("Last"); 
  ObjectDelete("This"); 
  ObjectDelete("Daily Range"); 
  ObjectDelete("Weekly Range");    
  ObjectDelete("WR_This_Week");
  ObjectDelete("WR_Last_Week");
  ObjectDelete("Weekly ADR");    
  ObjectDelete("WADR_This_Week");
  ObjectDelete("WADR_Last_Week");
  ObjectDelete( "Spread_" ); 
  ObjectDelete( "WHL" ); 
  ObjectDelete( "WLL" );
  ObjectDelete("Daily_Open"); 
  ObjectDelete("DailyRange_Pot_High");
  ObjectDelete("DailyRange_Pot_Low"); 
  ObjectDelete("DR_Quadrant_Low");
  ObjectDelete("DR_Quadrant_Mid_Low");
  ObjectDelete("DR_Quadrant_High");
  ObjectDelete("DR_Quadrant_Mid_High");  
                         
//----
  return(0);
}

int start(){ 

if(Digits==3 || Digits==5)
double vPoint = Point*10; 
   else 
      vPoint = Point;
      
// Daily Range Stats section:
if(Show_DR_Stats==true)
  {
  ObjectCreate("DR_Last_Mon", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_Last_Mon", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_Last_Mon", OBJPROP_XDISTANCE, Day_Label_x);
  ObjectSet("DR_Last_Mon", OBJPROP_YDISTANCE, Last_Week_y);
  
  ObjectCreate("DR_Last_Tue", OBJ_LABEL, 0, 0, 0);
  ObjectSet("DR_Last_Tue", OBJPROP_CORNER, DR_Stats_DisplayCorner);  // 
  ObjectSet("DR_Last_Tue", OBJPROP_XDISTANCE, Day_Label_x+50);
  ObjectSet("DR_Last_Tue", OBJPROP_YDISTANCE, Last_Week_y);
  
  ObjectCreate("DR_Last_Wed", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_Last_Wed", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_Last_Wed", OBJPROP_XDISTANCE, Day_Label_x+100);
  ObjectSet("DR_Last_Wed", OBJPROP_YDISTANCE, Last_Week_y);
  
  ObjectCreate("DR_Last_Thu", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_Last_Thu", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_Last_Thu", OBJPROP_XDISTANCE, Day_Label_x+150);
  ObjectSet("DR_Last_Thu", OBJPROP_YDISTANCE, Last_Week_y);
  
  ObjectCreate("DR_Last_Fri", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_Last_Fri", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_Last_Fri", OBJPROP_XDISTANCE, Day_Label_x+200);
  ObjectSet("DR_Last_Fri", OBJPROP_YDISTANCE, Last_Week_y);
   
  ObjectCreate("DR_This_Mon", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_This_Mon", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_This_Mon", OBJPROP_XDISTANCE, Day_Label_x);
  ObjectSet("DR_This_Mon", OBJPROP_YDISTANCE, This_Week_y);
  
  ObjectCreate("DR_This_Tue", OBJ_LABEL, 0, 0, 0);
  ObjectSet("DR_This_Tue", OBJPROP_CORNER, DR_Stats_DisplayCorner);  // 
  ObjectSet("DR_This_Tue", OBJPROP_XDISTANCE, Day_Label_x+50);
  ObjectSet("DR_This_Tue", OBJPROP_YDISTANCE, This_Week_y);
  
  ObjectCreate("DR_This_Wed", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_This_Wed", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_This_Wed", OBJPROP_XDISTANCE, Day_Label_x+100);
  ObjectSet("DR_This_Wed", OBJPROP_YDISTANCE, This_Week_y);
  
  ObjectCreate("DR_This_Thu", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_This_Thu", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_This_Thu", OBJPROP_XDISTANCE, Day_Label_x+150);
  ObjectSet("DR_This_Thu", OBJPROP_YDISTANCE, This_Week_y);
  
  ObjectCreate("DR_This_Fri", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("DR_This_Fri", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("DR_This_Fri", OBJPROP_XDISTANCE, Day_Label_x+200);
  ObjectSet("DR_This_Fri", OBJPROP_YDISTANCE, This_Week_y); 
  
  ObjectCreate("Monday", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Monday", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Monday", OBJPROP_XDISTANCE, Day_Label_x);
  ObjectSet("Monday", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Monday","Mon",9, "Berlin Sans FB", DR_Stats_Color);  
  
  ObjectCreate("Tuesday", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Tuesday", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Tuesday", OBJPROP_XDISTANCE, Day_Label_x+50);
  ObjectSet("Tuesday", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Tuesday","Tue",9, "Berlin Sans FB", DR_Stats_Color); 
  
  ObjectCreate("Wednesday", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Wednesday", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Wednesday", OBJPROP_XDISTANCE, Day_Label_x+100);
  ObjectSet("Wednesday", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Wednesday","Wed",9, "Berlin Sans FB", DR_Stats_Color);  
  
  ObjectCreate("Thursday", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Thursday", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Thursday", OBJPROP_XDISTANCE, Day_Label_x+150);
  ObjectSet("Thursday", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Thursday","Thu",9, "Berlin Sans FB", DR_Stats_Color);     

  ObjectCreate("Friday", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Friday", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Friday", OBJPROP_XDISTANCE, Day_Label_x+200);
  ObjectSet("Friday", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Friday","Fri",9, "Berlin Sans FB", DR_Stats_Color);
    
  ObjectCreate("Last", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Last", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Last", OBJPROP_XDISTANCE, Day_Label_x-72);
  ObjectSet("Last", OBJPROP_YDISTANCE, Last_Week_y); 
  ObjectSetText("Last","Last Week",9, "Berlin Sans FB", DR_Stats_Color);  
  
  ObjectCreate("This", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("This", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("This", OBJPROP_XDISTANCE, Day_Label_x-72);
  ObjectSet("This", OBJPROP_YDISTANCE, This_Week_y); 
  ObjectSetText("This","This Week",9, "Berlin Sans FB", DR_Stats_Color);  
  
  ObjectCreate("Daily Range", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Daily Range", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Daily Range", OBJPROP_XDISTANCE, Day_Label_x-72);
  ObjectSet("Daily Range", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Daily Range","Daily Range",9, "Berlin Sans FB", DR_Stats_Color); 
  
  ObjectCreate("Spread_", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Spread_", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Spread_", OBJPROP_XDISTANCE, Day_Label_x-72);
  ObjectSet("Spread_", OBJPROP_YDISTANCE, 54); 
  ObjectSetText("Spread_","Spread: ",9, "Berlin Sans FB", DR_Stats_Color);  
   
  ObjectCreate("WR_Last_Week", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("WR_Last_Week", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("WR_Last_Week", OBJPROP_XDISTANCE, Day_Label_x+250);
  ObjectSet("WR_Last_Week", OBJPROP_YDISTANCE, Last_Week_y); 
  
  ObjectCreate("WR_This_Week", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("WR_This_Week", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("WR_This_Week", OBJPROP_XDISTANCE, Day_Label_x+250);
  ObjectSet("WR_This_Week", OBJPROP_YDISTANCE, This_Week_y); 
  
  ObjectCreate("Weekly Range", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Weekly Range", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Weekly Range", OBJPROP_XDISTANCE, Day_Label_x+250);
  ObjectSet("Weekly Range", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Weekly Range","WSum",9, "Berlin Sans FB", DR_Stats_Color); 

  ObjectCreate("WADR_Last_Week", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("WADR_Last_Week", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("WADR_Last_Week", OBJPROP_XDISTANCE, Day_Label_x+300);
  ObjectSet("WADR_Last_Week", OBJPROP_YDISTANCE, Last_Week_y); 
  
  ObjectCreate("WADR_This_Week", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("WADR_This_Week", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("WADR_This_Week", OBJPROP_XDISTANCE, Day_Label_x+300);
  ObjectSet("WADR_This_Week", OBJPROP_YDISTANCE, This_Week_y); 
    
  ObjectCreate("Weekly ADR", OBJ_LABEL, 0, 0, 0);          // 
  ObjectSet("Weekly ADR", OBJPROP_CORNER, DR_Stats_DisplayCorner);
  ObjectSet("Weekly ADR", OBJPROP_XDISTANCE, Day_Label_x+300);
  ObjectSet("Weekly ADR", OBJPROP_YDISTANCE, 36); 
  ObjectSetText("Weekly ADR","WADR",9, "Berlin Sans FB", DR_Stats_Color);  
  
  
  
 Spread=NormalizeDouble(MarketInfo(Symbol(),MODE_SPREAD),0);
 if((Digits==5||Digits==3)&&Spread<10) {points="0.";} else points=""; 
 ObjectSetText("Spread_","Spread: "+points+DoubleToStr(Spread,0),9,"Berlin Sans FB",DR_Stats_Color);
 
if(Is_Saturday_Candles == false && Is_Sunday_Candles == false){int DayShift=0;} 
if(Is_Saturday_Candles == true && Is_Sunday_Candles == false){     DayShift=1;}
if(Is_Saturday_Candles == false && Is_Sunday_Candles == true){     DayShift=1;}
if(Is_Saturday_Candles == true && Is_Sunday_Candles == true){      DayShift=2;}

//Last week
 if(DayOfWeek()==1)
  {
 Mon_Shift = 5+DayShift;Tue_Shift = 4+DayShift;Wed_Shift = 3+DayShift;Thu_Shift = 2+DayShift;Fri_Shift = 1+DayShift;
 DR_Last_Mon = NormalizeDouble((iHigh(NULL,1440,Mon_Shift)-iLow(NULL,1440,Mon_Shift))/Point,Digits);
 DR_Last_Tue = NormalizeDouble((iHigh(NULL,1440,Tue_Shift)-iLow(NULL,1440,Tue_Shift))/Point,Digits);
 DR_Last_Wed = NormalizeDouble((iHigh(NULL,1440,Wed_Shift)-iLow(NULL,1440,Wed_Shift))/Point,Digits);
 DR_Last_Thu = NormalizeDouble((iHigh(NULL,1440,Thu_Shift)-iLow(NULL,1440,Thu_Shift))/Point,Digits);
 DR_Last_Fri = NormalizeDouble((iHigh(NULL,1440,Fri_Shift)-iLow(NULL,1440,Fri_Shift))/Point,Digits);
 WADR_Last_Week = (DR_Last_Mon+DR_Last_Tue+DR_Last_Wed+DR_Last_Thu+DR_Last_Fri)/5;
  }
  
 if(DayOfWeek()==2)
  {
 Mon_Shift = 6+DayShift;Tue_Shift = 5+DayShift;Wed_Shift = 4+DayShift;Thu_Shift = 3+DayShift;Fri_Shift = 2+DayShift;
 DR_Last_Mon = NormalizeDouble((iHigh(NULL,1440,Mon_Shift)-iLow(NULL,1440,Mon_Shift))/Point,Digits);
 DR_Last_Tue = NormalizeDouble((iHigh(NULL,1440,Tue_Shift)-iLow(NULL,1440,Tue_Shift))/Point,Digits);
 DR_Last_Wed = NormalizeDouble((iHigh(NULL,1440,Wed_Shift)-iLow(NULL,1440,Wed_Shift))/Point,Digits);
 DR_Last_Thu = NormalizeDouble((iHigh(NULL,1440,Thu_Shift)-iLow(NULL,1440,Thu_Shift))/Point,Digits);
 DR_Last_Fri = NormalizeDouble((iHigh(NULL,1440,Fri_Shift)-iLow(NULL,1440,Fri_Shift))/Point,Digits);
 WADR_Last_Week = (DR_Last_Mon+DR_Last_Tue+DR_Last_Wed+DR_Last_Thu+DR_Last_Fri)/5; 
  }
  
 if(DayOfWeek()==3)
  {
 Mon_Shift = 7+DayShift;Tue_Shift = 6+DayShift;Wed_Shift = 5+DayShift;Thu_Shift = 4+DayShift;Fri_Shift = 3+DayShift; 
 DR_Last_Mon = NormalizeDouble((iHigh(NULL,1440,Mon_Shift)-iLow(NULL,1440,Mon_Shift))/Point,Digits);
 DR_Last_Tue = NormalizeDouble((iHigh(NULL,1440,Tue_Shift)-iLow(NULL,1440,Tue_Shift))/Point,Digits);
 DR_Last_Wed = NormalizeDouble((iHigh(NULL,1440,Wed_Shift)-iLow(NULL,1440,Wed_Shift))/Point,Digits);
 DR_Last_Thu = NormalizeDouble((iHigh(NULL,1440,Thu_Shift)-iLow(NULL,1440,Thu_Shift))/Point,Digits);
 DR_Last_Fri = NormalizeDouble((iHigh(NULL,1440,Fri_Shift)-iLow(NULL,1440,Fri_Shift))/Point,Digits);
 WADR_Last_Week = (DR_Last_Mon+DR_Last_Tue+DR_Last_Wed+DR_Last_Thu+DR_Last_Fri)/5;
  }
  
 if(DayOfWeek()==4)
  {
 Mon_Shift = 8+DayShift;Tue_Shift = 7+DayShift;Wed_Shift = 6+DayShift;Thu_Shift = 5+DayShift;Fri_Shift = 4+DayShift;
 DR_Last_Mon = NormalizeDouble((iHigh(NULL,1440,Mon_Shift)-iLow(NULL,1440,Mon_Shift))/Point,Digits);
 DR_Last_Tue = NormalizeDouble((iHigh(NULL,1440,Tue_Shift)-iLow(NULL,1440,Tue_Shift))/Point,Digits);
 DR_Last_Wed = NormalizeDouble((iHigh(NULL,1440,Wed_Shift)-iLow(NULL,1440,Wed_Shift))/Point,Digits);
 DR_Last_Thu = NormalizeDouble((iHigh(NULL,1440,Thu_Shift)-iLow(NULL,1440,Thu_Shift))/Point,Digits);
 DR_Last_Fri = NormalizeDouble((iHigh(NULL,1440,Fri_Shift)-iLow(NULL,1440,Fri_Shift))/Point,Digits);
 WADR_Last_Week = (DR_Last_Mon+DR_Last_Tue+DR_Last_Wed+DR_Last_Thu+DR_Last_Fri)/5;
  }
  
 if(DayOfWeek()==5||DayOfWeek()==6||DayOfWeek()==7)
  {
 Mon_Shift = 9+DayShift;Tue_Shift = 8+DayShift;Wed_Shift = 7+DayShift;Thu_Shift = 6+DayShift;Fri_Shift = 5+DayShift;
 DR_Last_Mon = NormalizeDouble((iHigh(NULL,1440,Mon_Shift)-iLow(NULL,1440,Mon_Shift))/Point,Digits);
 DR_Last_Tue = NormalizeDouble((iHigh(NULL,1440,Tue_Shift)-iLow(NULL,1440,Tue_Shift))/Point,Digits);
 DR_Last_Wed = NormalizeDouble((iHigh(NULL,1440,Wed_Shift)-iLow(NULL,1440,Wed_Shift))/Point,Digits);
 DR_Last_Thu = NormalizeDouble((iHigh(NULL,1440,Thu_Shift)-iLow(NULL,1440,Thu_Shift))/Point,Digits);
 DR_Last_Fri = NormalizeDouble((iHigh(NULL,1440,Fri_Shift)-iLow(NULL,1440,Fri_Shift))/Point,Digits);
 WADR_Last_Week = (DR_Last_Mon+DR_Last_Tue+DR_Last_Wed+DR_Last_Thu+DR_Last_Fri)/5;
  }


// This week
 if(DayOfWeek()==1)
  {
 Mon_Shift = 0;Tue_Shift = -1;Wed_Shift = -2;Thu_Shift = -3;Fri_Shift = -4;
 DR_This_Mon = NormalizeDouble((iHigh(NULL,1440,Mon_Shift)-iLow(NULL,1440,Mon_Shift))/Point,Digits);
 DR_This_Tue = NormalizeDouble((iHigh(NULL,1440,Tue_Shift)-iLow(NULL,1440,Tue_Shift))/Point,Digits);
 DR_This_Wed = NormalizeDouble((iHigh(NULL,1440,Wed_Shift)-iLow(NULL,1440,Wed_Shift))/Point,Digits);
 DR_This_Thu = NormalizeDouble((iHigh(NULL,1440,Thu_Shift)-iLow(NULL,1440,Thu_Shift))/Point,Digits);
 DR_This_Fri = NormalizeDouble((iHigh(NULL,1440,Fri_Shift)-iLow(NULL,1440,Fri_Shift))/Point,Digits);
 WADR_This_Week = (DR_This_Mon)/DayOfWeek();
  }  

 if(DayOfWeek()==2)
  {
 Mon_Shift = 1;Tue_Shift = 0;Wed_Shift = -2;Thu_Shift = -3;Fri_Shift = -4;
 DR_This_Mon = NormalizeDouble((iHigh(NULL,1440,Mon_Shift)-iLow(NULL,1440,Mon_Shift))/Point,Digits);
 DR_This_Tue = NormalizeDouble((iHigh(NULL,1440,Tue_Shift)-iLow(NULL,1440,Tue_Shift))/Point,Digits);
 DR_This_Wed = NormalizeDouble((iHigh(NULL,1440,Wed_Shift)-iLow(NULL,1440,Wed_Shift))/Point,Digits);
 DR_This_Thu = NormalizeDouble((iHigh(NULL,1440,Thu_Shift)-iLow(NULL,1440,Thu_Shift))/Point,Digits);
 DR_This_Fri = NormalizeDouble((iHigh(NULL,1440,Fri_Shift)-iLow(NULL,1440,Fri_Shift))/Point,Digits);
 WADR_This_Week = (DR_This_Mon+DR_This_Tue)/DayOfWeek();
  }  

 if(DayOfWeek()==3)
  {
 Mon_Shift = 2;Tue_Shift = 1;Wed_Shift = 0;Thu_Shift = -3;Fri_Shift = -4;
 DR_This_Mon = NormalizeDouble((iHigh(NULL,1440,Mon_Shift)-iLow(NULL,1440,Mon_Shift))/Point,Digits);
 DR_This_Tue = NormalizeDouble((iHigh(NULL,1440,Tue_Shift)-iLow(NULL,1440,Tue_Shift))/Point,Digits);
 DR_This_Wed = NormalizeDouble((iHigh(NULL,1440,Wed_Shift)-iLow(NULL,1440,Wed_Shift))/Point,Digits);
 DR_This_Thu = NormalizeDouble((iHigh(NULL,1440,Thu_Shift)-iLow(NULL,1440,Thu_Shift))/Point,Digits);
 DR_This_Fri = NormalizeDouble((iHigh(NULL,1440,Fri_Shift)-iLow(NULL,1440,Fri_Shift))/Point,Digits);
 WADR_This_Week = (DR_This_Mon+DR_This_Tue+DR_This_Wed)/DayOfWeek();
  }   
 
 if(DayOfWeek()==4)
  {
 Mon_Shift = 3;Tue_Shift = 2;Wed_Shift = 1;Thu_Shift = 0;Fri_Shift = -4;
 DR_This_Mon = NormalizeDouble((iHigh(NULL,1440,Mon_Shift)-iLow(NULL,1440,Mon_Shift))/Point,Digits);
 DR_This_Tue = NormalizeDouble((iHigh(NULL,1440,Tue_Shift)-iLow(NULL,1440,Tue_Shift))/Point,Digits);
 DR_This_Wed = NormalizeDouble((iHigh(NULL,1440,Wed_Shift)-iLow(NULL,1440,Wed_Shift))/Point,Digits);
 DR_This_Thu = NormalizeDouble((iHigh(NULL,1440,Thu_Shift)-iLow(NULL,1440,Thu_Shift))/Point,Digits);
 DR_This_Fri = NormalizeDouble((iHigh(NULL,1440,Fri_Shift)-iLow(NULL,1440,Fri_Shift))/Point,Digits);
 WADR_This_Week = (DR_This_Mon+DR_This_Tue+DR_This_Wed+DR_This_Thu)/DayOfWeek();
  }   

 if(DayOfWeek()==5||DayOfWeek()==6||DayOfWeek()==7)
  {
 Mon_Shift = 4;Tue_Shift = 3;Wed_Shift = 2;Thu_Shift = 1;Fri_Shift = 0;
 DR_This_Mon = NormalizeDouble((iHigh(NULL,1440,Mon_Shift)-iLow(NULL,1440,Mon_Shift))/Point,Digits);
 DR_This_Tue = NormalizeDouble((iHigh(NULL,1440,Tue_Shift)-iLow(NULL,1440,Tue_Shift))/Point,Digits);
 DR_This_Wed = NormalizeDouble((iHigh(NULL,1440,Wed_Shift)-iLow(NULL,1440,Wed_Shift))/Point,Digits);
 DR_This_Thu = NormalizeDouble((iHigh(NULL,1440,Thu_Shift)-iLow(NULL,1440,Thu_Shift))/Point,Digits);
 DR_This_Fri = NormalizeDouble((iHigh(NULL,1440,Fri_Shift)-iLow(NULL,1440,Fri_Shift))/Point,Digits);
 WADR_This_Week = (DR_This_Mon+DR_This_Tue+DR_This_Wed+DR_This_Thu+DR_This_Fri)/5;
  }  
 
 if(Digits==5||Digits==3) {Factor=10;}  else Factor=1;  
  text=DoubleToStr(DR_Last_Mon/Factor,0);                                                    // 
  ObjectSetText("DR_Last_Mon",text,9,"Berlin Sans FB", DR_Stats_Color);
  
  text=DoubleToStr(DR_Last_Tue/Factor,0);                                                  // 
  ObjectSetText("DR_Last_Tue",text,9, "Berlin Sans FB", DR_Stats_Color);
  
  text=DoubleToStr(DR_Last_Wed/Factor,0);                                                         // 
  ObjectSetText("DR_Last_Wed",text,9, "Berlin Sans FB", DR_Stats_Color);  

  text=DoubleToStr(DR_Last_Thu/Factor,0);                                                         // 
  ObjectSetText("DR_Last_Thu",text,9, "Berlin Sans FB", DR_Stats_Color);  
  
  text=DoubleToStr(DR_Last_Fri/Factor,0);                                                        // 
  ObjectSetText("DR_Last_Fri",text,9, "Berlin Sans FB", DR_Stats_Color);
  
  text=DoubleToStr(DR_This_Mon/Factor,0);                                                   // 
  ObjectSetText("DR_This_Mon",text,9, "Berlin Sans FB", DR_Stats_Color);
  
  text=DoubleToStr(DR_This_Tue/Factor,0);                                                 // 
  ObjectSetText("DR_This_Tue",text,9, "Berlin Sans FB", DR_Stats_Color);
  
  text=DoubleToStr(DR_This_Wed/Factor,0);                                                        // 
  ObjectSetText("DR_This_Wed",text,9, "Berlin Sans FB", DR_Stats_Color);  

  text=DoubleToStr(DR_This_Thu/Factor,0);                                                       // 
  ObjectSetText("DR_This_Thu",text,9, "Berlin Sans FB", DR_Stats_Color);  
  
  text=DoubleToStr(DR_This_Fri/Factor,0);                                                       // 
  ObjectSetText("DR_This_Fri",text,9, "Berlin Sans FB", DR_Stats_Color);
  
  WR_Last_Week=DR_Last_Mon+DR_Last_Tue+DR_Last_Wed+DR_Last_Thu+DR_Last_Fri;
  WR_This_Week=DR_This_Mon+DR_This_Tue+DR_This_Wed+DR_This_Thu+DR_This_Fri;
    
  text=DoubleToStr(WR_This_Week/Factor,0);                                                       // 
  ObjectSetText("WR_This_Week",text,9, "Berlin Sans FB", DR_Stats_Color); 
  
  text=DoubleToStr(WR_Last_Week/Factor,0);                                                       // 
  ObjectSetText("WR_Last_Week",text,9, "Berlin Sans FB", DR_Stats_Color);

  text=DoubleToStr(WADR_Last_Week/Factor,0);                                                       // 
  ObjectSetText("WADR_Last_Week",text,9, "Berlin Sans FB", DR_Stats_Color); 
  
  text=DoubleToStr(WADR_This_Week/Factor,0);                                                       // 
  ObjectSetText("WADR_This_Week",text,9, "Berlin Sans FB", DR_Stats_Color);   
//----
if(Show_DR_HL_Lines==true)
  {
  
  if(Which_Week_DR == 0) {double Which_Week = WADR_This_Week;}
  if(Which_Week_DR == 1) {       Which_Week = WADR_Last_Week;} 
               
               ObjectSet("WHL", OBJPROP_TIME1, Time[0]);
               ObjectSet("WHL", OBJPROP_PRICE1, iLow(NULL,1440,0)+Which_Week/Factor*vPoint);
               
               ObjectSet("WLL", OBJPROP_TIME1, Time[0]);
               ObjectSet("WLL", OBJPROP_PRICE1, iHigh(NULL,1440,0)-Which_Week/Factor*vPoint);
               
               ObjectSet("Daily_Open", OBJPROP_TIME1, iTime(Symbol(),1440,Bars));
               ObjectSet("Daily_Open", OBJPROP_TIME2, iTime(Symbol(),0,0)+Quadrant_Tf);
               ObjectSet("Daily_Open", OBJPROP_PRICE1, iOpen(NULL,1440,0));
               ObjectSet("Daily_Open", OBJPROP_PRICE2, iOpen(NULL,1440,0));
              
               ObjectSet("DailyRange_Pot_High", OBJPROP_TIME1, iTime(Symbol(),1440,Bars));
               ObjectSet("DailyRange_Pot_High", OBJPROP_TIME2, iTime(Symbol(),0,0)+Quadrant_Tf);
               ObjectSet("DailyRange_Pot_High", OBJPROP_PRICE1, iLow(NULL,1440,0)+Which_Week/Factor*vPoint);
               ObjectSet("DailyRange_Pot_High", OBJPROP_PRICE2, iLow(NULL,1440,0)+Which_Week/Factor*vPoint);
               
               ObjectSet("DailyRange_Pot_Low", OBJPROP_TIME1, iTime(Symbol(),1440,Bars));
               ObjectSet("DailyRange_Pot_Low", OBJPROP_TIME2, iTime(Symbol(),0,0)+Quadrant_Tf);
               ObjectSet("DailyRange_Pot_Low", OBJPROP_PRICE1, iHigh(NULL,1440,0)-Which_Week/Factor*vPoint);
               ObjectSet("DailyRange_Pot_Low", OBJPROP_PRICE2, iHigh(NULL,1440,0)-Which_Week/Factor*vPoint);
              
  }
  
if(Show_Quadrant_Lines==true)
  {
  if(Which_Week_DR == 0) {       Which_Week = WADR_This_Week;}
  if(Which_Week_DR == 1) {       Which_Week = WADR_Last_Week;} 
    
               ObjectSet("DR_Quadrant_High", OBJPROP_TIME1, iTime(Symbol(),Quadrant_Tf,Bars));
               ObjectSet("DR_Quadrant_High", OBJPROP_TIME2, iTime(Symbol(),0,0)+Quadrant_Tf);
               ObjectSet("DR_Quadrant_High", OBJPROP_PRICE1, iOpen(NULL,Quadrant_Tf,0)+Which_Week/Factor*vPoint);
               ObjectSet("DR_Quadrant_High", OBJPROP_PRICE2, iOpen(NULL,Quadrant_Tf,0)+Which_Week/Factor*vPoint);  
                 
               ObjectSet("DR_Quadrant_Mid_High", OBJPROP_TIME1, iTime(Symbol(),Quadrant_Tf,Bars));
               ObjectSet("DR_Quadrant_Mid_High", OBJPROP_TIME2, iTime(Symbol(),0,0)+Quadrant_Tf);
               ObjectSet("DR_Quadrant_Mid_High", OBJPROP_PRICE1, iOpen(NULL,Quadrant_Tf,0)+Which_Week/Factor*vPoint/2);
               ObjectSet("DR_Quadrant_Mid_High", OBJPROP_PRICE2, iOpen(NULL,Quadrant_Tf,0)+Which_Week/Factor*vPoint/2); 
                               
               ObjectSet("Daily_Open", OBJPROP_TIME1, iTime(Symbol(),Quadrant_Tf,Bars));
               ObjectSet("Daily_Open", OBJPROP_TIME2, iTime(Symbol(),0,0)+Quadrant_Tf);
               ObjectSet("Daily_Open", OBJPROP_PRICE1, iOpen(NULL,Quadrant_Tf,0));
               ObjectSet("Daily_Open", OBJPROP_PRICE2, iOpen(NULL,Quadrant_Tf,0));

               ObjectSet("DR_Quadrant_Mid_Low", OBJPROP_TIME1, iTime(Symbol(),Quadrant_Tf,Bars));
               ObjectSet("DR_Quadrant_Mid_Low", OBJPROP_TIME2, iTime(Symbol(),0,0)+Quadrant_Tf);
               ObjectSet("DR_Quadrant_Mid_Low", OBJPROP_PRICE1, iOpen(NULL,Quadrant_Tf,0)-Which_Week/Factor*vPoint/2);
               ObjectSet("DR_Quadrant_Mid_Low", OBJPROP_PRICE2, iOpen(NULL,Quadrant_Tf,0)-Which_Week/Factor*vPoint/2); 
                              
               ObjectSet("DR_Quadrant_Low", OBJPROP_TIME1, iTime(Symbol(),Quadrant_Tf,Bars));
               ObjectSet("DR_Quadrant_Low", OBJPROP_TIME2, iTime(Symbol(),0,0)+Quadrant_Tf);
               ObjectSet("DR_Quadrant_Low", OBJPROP_PRICE1, iOpen(NULL,Quadrant_Tf,0)-Which_Week/Factor*vPoint);
               ObjectSet("DR_Quadrant_Low", OBJPROP_PRICE2, iOpen(NULL,Quadrant_Tf,0)-Which_Week/Factor*vPoint);
                                               
  }                
//----                 
  }
//----

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