# How do I get the time that is most on the right of the chart?

175

Hi,

How can I find out (programmaticaly) what the time is on the rightmost (not yet initialized) bar on the chart?

For clarification:

What is the time where the arrow is pointing? It's in the future obviously, but how much? I can't just add some time amount to the current bar time because this empty space can be controlled individually via the chart displacement arrow on the top of the window... Ideas? :/

17786

Use these functions:
```ChartGetInteger(0,CHART_VISIBLE_BARS,0)
ChartGetInteger(0,CHART_WIDTH_IN_BARS,0)```
15917

1.  It's not pointing to any time. You can't just add time periods because no ticks during a period, no bar; think weekend, market holiday, or no ticks for minutes Asian session/M1 chart.

2.  You can calculate how many bars, as Taras Slobodyanik hinted at, or use my code (old MT4 style) Chart Price Max/Min - MQL4 and MetaTrader 4 - MQL4 programming forum

But in either case you can only estimate the time, and any (non-label objects) you draw, must be moved/adjusted at each new bar or chart change.

3. You shouldn't care. Why do you?
175

whroeder1:
1.  It's not pointing to any time. You can't just add time periods because no ticks during a period, no bar; think weekend, market holiday, or no ticks for minutes Asian session/M1 chart.

2.  You can calculate how many bars, as Taras Slobodyanik hinted at, or use my code (old MT4 style) Chart Price Max/Min - MQL4 and MetaTrader 4 - MQL4 programming forum

But in either case you can only estimate the time, and any (non-label objects) you draw, must be moved/adjusted at each new bar or chart change.

3. You shouldn't care. Why do you?
I wanted to place a fibonacci object to the right of price and misuse it as a display of significant levels. Taras solution worked for that case :)
Use these functions:

Thank you, works fine :)