Next bar ending time, how to calculate

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1260
Joined: 23 Nov 2010
Has thanked: 716 times
Been thanked: 221 times

Next bar ending time, how to calculate

Postby arjfca » 22 Sep 2011

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

User avatar
TJ
Posts: 6518
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 957 times
Been thanked: 1883 times

Re: Next bar ending time, how to calculate

Postby TJ » 22 Sep 2011

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


Return to “MultiCharts”