and if there's a function to get time length of the bar?
and if there's a way to get different in time between each 2 bars, say
Time[2]-Time[3] will give me how many minutes of each bar length.
but if Time[2] is 10:00AM, and Time[3] is 9:55am, it will only give 45 which is supposed to be 5 minutes not 45 minutes.
thanks
what is the function to get the close time of N bar ago?
-
- Posts: 91
- Joined: 10 Dec 2010
- Has thanked: 2 times
- Been thanked: 1 time
what is the function to get the close time of N bar ago?
Last edited by martingale on 30 Mar 2012, edited 1 time in total.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: what is the function to get the close time of N bar ago?
and if there's a function to get time length of the bar?
Can you describe your idea (and application) in more detail?
What kind of bar? From a minute chart? Tick chart?
Can you draw a diagram?
-
- Posts: 91
- Joined: 10 Dec 2010
- Has thanked: 2 times
- Been thanked: 1 time
Re: what is the function to get the close time of N bar ago?
1. let's say 3 minute bar, i'd like to find out how many time difference in minute is P bar ago and P-1 bar ago. i.e. Time[P-1] - Time[P] in terms of minutesand if there's a function to get time length of the bar?
Can you describe your idea (and application) in more detail?
What kind of bar? From a minute chart? Tick chart?
Can you draw a diagram?
2. and trying to find a way to get time_span_of_current_bar, which is 3 minutes for each bar in my chart.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: what is the function to get the close time of N bar ago?
1. let's say 3 minute bar, i'd like to find out how many time difference in minute is P bar ago and P-1 bar ago. i.e. Time[P-1] - Time[P] in terms of minutesand if there's a function to get time length of the bar?
Can you describe your idea (and application) in more detail?
What kind of bar? From a minute chart? Tick chart?
Can you draw a diagram?
2. and trying to find a way to get time_span_of_current_bar, which is 3 minutes for each bar in my chart.
MultiCharts use End-of-Bar (EOB) time for chart time stamp.
You will need to use CURRENTTIME minus TIME[1] to find the time lapsed since bar start.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: what is the function to get the close time of N bar ago?
What TJ says, plus to add..
which returns:
Can for example be done as following:i'd like to find out how many time difference in minute is P bar ago and P-1 bar ago. i.e. Time[P-1] - Time[P] in terms of minutes
Code: Select all
Variables:
timeThisBar(0), timePrevBar(0), oneSecond(ELTimeToDateTime_s(1)), secondsInBar(0);
if (LastBarOnChart_s = True) then begin
timeThisBar = Time_s;
timePrevBar = Time_s[1];
secondsInBar= (ELTimeToDateTime_s(timeThisBar) - ELTimeToDateTime_s(timePrevBar)) / oneSecond;
Print("Time this bar: ", FormatTime("HH:mm:ss", ELTimeToDateTime_s(timeThisBar)), NewLine,
"Time previous bar: ", FormatTime("HH:mm:ss", ELTimeToDateTime_s(timePrevBar)), Newline,
"Seconds in bar: ", NumToStr(secondsInBar, 2));
end;
Code: Select all
Time this bar: 21:59:59
Time previous bar: 21:59:35
Seconds in bar: 24.00