Draw rectangle, but it is not reflecting to given price 1 and price 2 value

 

Hi Everyone,


I would like draw rectangle on everyday, im looking for your kind guidance. 

below are the code i wanted to draw rectangle for H1 based on D1 value, but im not able to draw anything on the chart.

int dayOfWeek = DayOfWeek();
datetime tomorrows_time = iTime(NULL,PERIOD_D1,0) + 86400;
datetime today_time = iTime(NULL,PERIOD_D1,0);
   
  
double DayLowest = iLow(_Symbol,PERIOD_D1,0);
double DayHighest = iHigh(_Symbol,PERIOD_D1,0);
 
int integer; 
int integer2;  
   
integer =  DayLowest/Point;
integer2 =  DayHighest/Point;

 
  if ((dayOfWeek != 6) && (dayOfWeek != 0))
  {  
  ObjectCreate("Draw", OBJ_RECTANGLE,0,today_time,Low[integer]*Point ,tomorrows_time,High[integer2]*Point);
  }

if i change the objectcreate code as follow, it the rectangle always drawn at the opening of the early candle, eventhough the price value had key in highest price and lowest price

ObjectCreate("Draw", OBJ_RECTANGLE,0,today_time,DayLowest  ,tomorrows_time,DayHighest );


for the moment, new rectangle is drawn on new day, the yesterday rectangle will be deleted.

But im using for loop to create a new name for every object name. it works, but still the rectangle draw on the opening of the candle. 

  for (int i = 0; i < 5; i++)
  {
  string date = TimeToStr(Time[i],TIME_DATE);
  
  if ((dayOfWeek != 6) && (dayOfWeek != 0))
  {  
  ObjectCreate("Draw" + date , OBJ_RECTANGLE,0,today_time,DayLowest ,tomorrows_time,DayHighest);
  }  
}


I have include Object Set, the result still wont move the rectangle to the given value. 

Really looking forward for any kind words.

Thank you in advance. 



 
cklaii:


you can't draw into the future