EL time question
EL time question
I have been unable to workout out the syntax that gives time in seconds from the start of the day. Any suggestions would be welcome.
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: EL time question
can you explain a bit more on what do you want to do? and what have you tried?I have been unable to workout out the syntax that gives time in seconds from the start of the day. Any suggestions would be welcome.
look up
TIME_s
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: EL time question
Like TJ said, you need Time_s for this. You probably also want something like SessionStartTime() if you don't want to manually enter your start time for the first session of the bar. Then you'll need to convert these HHmmss and HHmm formats to a numerical format that makes it possible to calculate with time - DataTime conversion will take care of that.I have been unable to workout out the syntax that gives time in seconds from the start of the day. Any suggestions would be welcome.
Then you'll get something like the following:
Code: Select all
Variables:
secondsSinceOpen(0), oneSecond(ELTimeToDateTime_s(1));
if (LastBarOnChart_s = True) then begin
secondsSinceOpen = (ELTimeToDateTime_s(Time_s) - ELTimeToDateTime(SessionStartTime(0, 1))) / oneSecond;
Print("Current time of bar: ", NumToStr(Time_s, 0), " Session open time: ", NumToStr(SessionStartTime(0, 1), 0), " seconds passed: ",
NumToStr(secondsSinceOpen, 0));
end;
Code: Select all
Current time of bar: 215959 Session open time: 800 seconds passed: 50399
Re: EL time question
Thanks that's exactly what I was trying to do, "The ELTimeToDateTime_s(Time_s)" function was what I was missing