Updated Code That Works With Midnight Time Stamp

Updated Code for the Midnight Hour

UPDATE: October 12, 2023.  I found an error in the code.  I will comment it out and show you the correction.   Copy and paste can get you into trouble.

I was working with some code for my latest book – Easing Into EasyLanguage – The Hi-Res Edition and streamlined some code from an old post.

startTime = sessionStartTime(0,1); 
//endTime = sessionStartTime(0,1); WRONG!
endTime = sessionEndTime(0,1);

if startTime > endTime then
begin
endTimeOffset = 0;
if t >= startTime+barInterval and t<= 2359 then endTimeOffSet = 2400-endTime;
end;

if t-endTimeOffSet < endTime then
begin
...
...
...
...
end.
Updated Code That Works with 0000 Time Stamp
24 Hour Session

Now you can carve out times to trade that bridge the midnight hour.  You just need to use the above code for when the your StartTime is greater than your EndTime.

So if you want to trade from 20:00 to 05:00 (8 PM to 5 AM) then just use this code and it will work every time.

I wanted to make sure I did a post for November to keep my record alive and to let you know I am wrapping up the Hi-Res edition and will be on the bookshelves before Christmas – I hope.

 

 


Discover more from George Pruitt

Subscribe to get the latest posts sent to your email.

Leave a Reply