Bars count

 
Greeting to all,
I start learning mql4 and i want to write a code to count the bars between two dates on H1 chart, and if possible how to add and subtract a number of bars to/from a starting point and draw a vertial line.
Ie.
Starting date 'D 2017.12.10 08.00' adding say 4 bars will draw a VLine on 'D 2017.12.10 12.00' .
Subtracting 6 bars will draw a VLine on 'D 2017.12.10 02.00' 
 
  1. Get the bar index for the given dates.
              iBarShift - Timeseries and Indicators Access - MQL4 Reference

  2. To draw on a given index, use that bar's Time.
 
whroeder1:
  1. Get the bar index for the given dates.
              iBarShift - Timeseries and Indicators Access - MQL4 Reference

  2. To draw on a given index, use that bar's Time.
A millon thanks man for giving your time.

I did try the first point and works fine.
The second piont it did not. Cos it's not what i need as per the second part of my question.

The second part is a separate question .i dont know the bar time to use it but i know the number of bars to add.
I have this date   'D 2017.12.10 08.00' adding say 4 bars will draw a VLine on 'D 2017.12.10 12.00' .


 
redahussien: i dont know the bar time to use it but i know the number of bars to add.
whroeder1:

  1. To draw on a given index, use that bar's Time.
Asked and answered. If you add the number of bars you get an index. If you have an index, you can get its time. If you have the time you can create your object.