Download MetaTrader 5

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

To add comments, please log in or register
RichPiano
175
RichPiano  

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 that time right there?


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? :/


Thanks in advance!

Taras Slobodyanik
17786
Taras Slobodyanik  
Use these functions:
ChartGetInteger(0,CHART_VISIBLE_BARS,0)
ChartGetInteger(0,CHART_WIDTH_IN_BARS,0)
whroeder1
15917
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. "Free-of-Holes" Charts - MQL4 Articles
    No candle if open = close ? - MQL4 and MetaTrader 4 - MQL4 programming forum

  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?
RichPiano
175
RichPiano  
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. "Free-of-Holes" Charts - MQL4 Articles
    No candle if open = close ? - MQL4 and MetaTrader 4 - MQL4 programming forum

  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 :)

To add comments, please log in or register