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'
- Vline to draw a line after spicific number of bars....it count holidays also....
- Custom Indicator Development Question
- Draw Vertical Line to Future Time
- Get the bar index for the given dates.
iBarShift - Timeseries and Indicators Access - MQL4 Reference - To draw on a given index, use that bar's Time.
whroeder1:
- Get the bar index for the given dates.
iBarShift - Timeseries and Indicators Access - MQL4 Reference - To draw on a given index, use that bar's Time.
A millon thanks man for giving your time.
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.
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.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register