# Next bar ending time, how to calculate

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1276
Joined: 23 Nov 2010
Has thanked: 722 times
Been thanked: 222 times

### Next bar ending time, how to calculate

Hello

Is there a way to get the ending time of the next following bar?

Time: Actual bar ending
Time[1] :Last bar ending

Next bar ending ?

Martin

TJ
Posts: 6873
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 984 times
Been thanked: 1976 times

### Re: Next bar ending time, how to calculate

arjfca wrote:Hello

Is there a way to get the ending time of the next following bar?

Time: Actual bar ending
Time[1] :Last bar ending

Next bar ending ?

Martin

There is no ONE solution for all situations.

if it is a non-time-based chart, or a seconds chart,
the next bar is TIME_s plus 1 second.

if it is a minute chart,
the next bar is TIME plus BARINTERVAL.

except... when the time is at the top of the hour,
you might get funny invalid time (eg. 1030 + 60 = 1090).

To calculate the time properly,
you will need to use TimeToMinutes(eTime) to convert the time.

See this chapter for detail:
EasyLanguage Reference Guide
Manipulating Dates and Times.......... pg. 15
These users thanked the author TJ for the post (total 2):
arjfcaHenry MultiСharts