I would like to be able to calculate time in seconds from the current time to x bars back- where x bars may have occurred on a previous day. I am using range bars.
TimeToSeconds(time_s)-TimeToSeconds(time_s[xbars])
Is there a function that gives cumulative seconds from one session to another.
time to seconds on a previous day
- TJ
- Posts: 7745
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2224 times
Re: time to seconds on a previous day
"Time" is a tricky issue in programming,I would like to be able to calculate time in seconds from the current time to x bars back- where x bars may have occurred on a previous day. I am using range bars.
TimeToSeconds(time_s)-TimeToSeconds(time_s[xbars])
Is there a function that gives cumulative seconds from one session to another.
not just in EasyLanguage, but in all programming endeavors.
This is a good primer on the ins-and-outs of time:
The TS Technologies EasyLanguage Reference Guide
CHAPTER: 2 - The Basic EasyLanguage Elements
Manipulating Dates and Times..... pg. 15
you can get the ebook here:
https://www.multicharts.com/multicharts ... mentation/
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: time to seconds on a previous day
Dear jl12,Is there a function that gives cumulative seconds from one session to another.
There is no such function, but you can write one. Something like this:
Code: Select all
variables: datetime1(0), datetime2(0), diff(0), in_seconds(0), xbars(0);
datetime1 = datetojulian(date) + eltimetodatetime_s(time_s);
datetime2 = datetojulian(date[xbars]) + eltimetodatetime_s(time_s[xbars]);
diff = datetime2 - datetime1;
in_seconds = intportion(diff)*24*60*60 + TimeToSeconds(datetime2eltime_s(diff));