Next bar ending time, how to calculate

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 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: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Next bar ending time, how to calculate

Postby TJ » 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
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


Return to “MultiCharts”