VLine Strange problem

Back to topics list To post a new topic, please log in or register
avatar
157
cashcube 2016.08.17 08: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.

 

avatar
12985
WHRoeder 2016.08.17 18: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.
avatar
157
cashcube 2016.08.18 05: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.. 

Back to topics list  

To add comments, please log in or register