Download MetaTrader 5
To add comments, please log in or register
MQL5 Reference is available in 8 languages. Learn MQL5 in the language that suits you best!
Mimi
499
Mimi 2016.08.17 06:50 

Hello, 

I have this code which draws VLine.

datetime N = iTime(Symbol(),PERIOD_D1,0);

for(int ml=0;ml <96; ml++)
{ 
  MTemp[ml] = rv(A + (fixed Data * ml));
  
  for(int pl=0; pl < 9; pl++)
    {   
         double Ap = MathAbs(MTemp[ml] - PTemp[pl]);
   
           if(Calculation)
           {
                
               datetime dt1 = N + (ml*900);
               Obj_Name = StringConcatenate(IntegerToString(pl),"zero_Level");
               ObjectCreate(Obj_Name,OBJ_VLINE,0,dt1,0); 
               ObjectSet(Obj_Name, OBJPROP_COLOR,Col17);
               ObjectSet(Obj_Name, OBJPROP_STYLE,Stl0);
               ObjectSet(Obj_Name,OBJPROP_WIDTH, width2); 
               ObjectSet(Obj_Name, OBJPROP_BACK,ObjOnBckgrnd);
               ObjectSet(Obj_Name, OBJPROP_SELECTABLE,objectselectable);
               ObjectSet(Obj_Name, OBJPROP_HIDDEN,objecthidden);
               ObjectSet(Obj_Name,OBJPROP_READONLY,ObjReadOnly);
               ObjectSetString(CI,Obj_Name,OBJPROP_TOOLTIP,StringConcatenate(PName[pl]," Line = ",TimeToString((N+(ml*900)),TIME_MINUTES)));
  
 
          }

   }
}
          

Now this Vline get drawn in wrong timing . In the tooltip data its shows correct timing but plotting in wrong timing. Why is that.

I figure that it has some problem taking ml. But in case of tooltip ml data is perfectly ok, so as the timing. Then why this difference?

Clueless. Please help.

whroeder1
13596
whroeder1 2016.08.17 16:31  
cashcube: Now this Vline get drawn in wrong timing . In the tooltip data its shows correct timing but plotting in wrong timing. Why is that.
Obj_Name = StringConcatenate(IntegerToString(pl),"zero_Level");
ObjectCreate(Obj_Name,OBJ_VLINE,0,dt1,0); 
Once you create it, ObjectCreate will subsequently fail so it will be in the original dt1 position. If it exists, move it.
Mimi
499
Mimi 2016.08.18 03:39  
WHRoeder:
Once you create it, ObjectCreate will subsequently fail so it will be in the original dt1 position. If it exists, move it.

Thank you WHRoeder, Problem solved! 

Learning.. 

/
To add comments, please log in or register