Vline to draw a line after spicific number of bars....it count holidays also....

 

hi ..as a new to mql programming ...still want to learn and have a question 

i try to write a code to draw a Vline a head from a predetermined bar or (datetime)

first i draw a rectangle (i need it in my strategy) and want the the indicator to draw a line at the end to the rectangle

lets say the first point of the rectangle is at 2015.07.01  00:00  and the second point of the rectangle is after 150 bars

i used 86400 as the number of seconds in the day

but: the Vline is drawn after 104 bars....it seems the the indicator count for holidays ....

how to fix this and make this code count also for holidays

 

        int ii2=150 ; //baraheads
  int xxx2=ii2*86400;
      int yyy2= StartTime+(xxx2);

       ObjectDelete("timerectangle2");//"2018.01.09 00:00"
   ObjectCreate("timerectangle2", OBJ_RECTANGLE,0,"2015.07.01 00:00",High[shif],yyy2,Low[shif]); 
      ObjectSet("timerectangle2", OBJPROP_STYLE,0 );
      ObjectSet("timerectangle2", OBJPROP_COLOR, Blue);


/////draw the Vline at the end of the timerectangle2
ObjectDelete("VERTECALLINE2");
      ObjectCreate( "VERTECALLINE2","VERTECALLINE2", OBJ_VLINE,0,yyy2,0);// Distancfrombar
       ObjectSet( "VERTECALLINE2", OBJPROP_STYLE, STYLE_DASH);
      ObjectSet( "VERTECALLINE2", OBJPROP_COLOR, Aqua);
       ObjectSet("VERTECALLINE2", OBJPROP_BACK, true); 
        ObjectSet("VERTECALLINE2", OBJPROP_WIDTH,1);
 

Calculate the time distance using number of bars * PeriodSeconds()   ( or _Period*60 )

It will need to be recalculated every new bar until the calculated time is smaller or = the current bar.

 
Keith Watford:

Calculate the time distance using number of bars * PeriodSeconds()   ( or _Period*60 )

It will need to be recalculated every new bar until the calculated time is smaller or = the current bar.

Keith Watford

thanks for your replay .i will try this 

 appreciate