Object Problem

 

Below I have my supply and demand EA, when attaching my EA everything works fine but the problem is when zooming out on a currency pair my supply and demand rectangles don't appear the same. Instead they appear as resistance and support. This is incorrect as I want my EA to view supply and demand rectangles when zooming out and when my EA is running.

#property strict

extern color ColourDemand=clrGreen;

extern color ColourSupply=clrRed;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
 {
  int Demand=iLowest(Symbol(),0,MODE_LOW,75,1+10);
  ObjectCreate(0,"Demand",OBJ_RECTANGLE,0,Time[Demand],Close[Demand],Time[0],Low[Demand]);
  ObjectSetInteger(0,"Demand",OBJPROP_COLOR,ColourDemand);
  
  int Supply=iHighest(Symbol(),0,MODE_HIGH,75,1+10);
  ObjectCreate(0,"Supply",OBJ_RECTANGLE,0,Time[Supply],Close[Supply],Time[0],High[Supply]);
  ObjectSetInteger(0,"Supply",OBJPROP_COLOR,ColourSupply);
  
  return(INIT_SUCCEEDED);
 }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
 {
  ObjectDelete(0,"Demand");
  
  ObjectDelete(0,"Supply");
 }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
 {
  static datetime BarCurrent=WRONG_VALUE;
  datetime BarPrevious=BarCurrent;
  BarCurrent=iTime(Symbol(),0,0);
  bool NewBarEvent=(BarCurrent!=BarPrevious);
  
  if(NewBarEvent)
  {
   int Demand=iLowest(Symbol(),0,MODE_LOW,75,1+10);
   
   int Supply=iHighest(Symbol(),0,MODE_HIGH,75,1+10);
   
   if(BarPrevious==WRONG_VALUE)
   {
    ObjectCreate(0,"Demand",OBJ_RECTANGLE,0,Time[Demand],Close[Demand],Time[0],Low[Demand]);
    ObjectSetInteger(0,"Demand",OBJPROP_COLOR,ColourDemand);
    
    ObjectCreate(0,"Supply",OBJ_RECTANGLE,0,Time[Supply],Close[Supply],Time[0],High[Supply]);
    ObjectSetInteger(0,"Supply",OBJPROP_COLOR,ColourSupply);
   }
   else
   {
    ObjectMove(0,"Demand",0,Time[0],Close[Demand]);
    ObjectMove(0,"Demand",1,0,Low[Demand]);
    
    ObjectMove(0,"Supply",0,Time[0],Close[Supply]);
    ObjectMove(0,"Supply",1,0,High[Supply]);
   } 
   
  }
   
 }

 


This is the problem I'm facing right now 




 
Scalper8:

Below I have my supply and demand EA, when attaching my EA everything works fine but the problem is when zooming out on a currency pair my supply and demand rectangles don't appear the same. Instead they appear as resistance and support. This is incorrect as I want my EA to view supply and demand rectangles when zooming out and when my EA is running.

This is the problem I'm facing right now 

I had to add another time function on Object Move function

 ObjectMove(0,"Demand",1,0,Low[Demand]);
    
 ObjectMove(0,"Supply",1,0,High[Supply]);
ObjectMove(0,"Demand",1,Time[Demand],Low[Demand]);

ObjectMove(0,"Supply",1,Time[Supply],High[Supply]);