Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time filter for one session that spans 2 days because of timezone difference

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Time filter for one session that spans 2 days because of timezone difference

    Hi,

    What is the best way to implement a time filter that is across 2 days where the start time is late in the pm say 220000 and then end time is early in the am 080000?

    Would this be ok?

    Code:
    if(ToTime(Time[0]) >= 220000 && ToTime(Time[0]) < 000000 || ToTime(Time[0]) >= 000000 && ToTime(Time[0]) < 080000)
    If anyone has any suggestions that would be much appreciated.

    Regards,
    suprsnipes

    #2
    Hi Suprsnipes,

    The code you gave is a great start to the time filter.In the first series of ToTime(), the second ToTime() is checking if the time is less than 000000, which in a time standard does not exist. One small change though would make this work.

    Change the second
    Code:
    ToTime(Time[0]) < 000000
    to
    Code:
    ToTime(Time[0]) <= 235959
    This will ensure that the time filter is for the correct time and calculating up to 11:59:59pm and not 00:00:00.

    I would also get rid of ToTime(Time[0]) <= 000000 since every time stamp will be greater than 000000 and no need to tell the program that.

    Code:
    ToTime(Time[0]) >= 220000 && ToTime(Time[0]) <= 235959 || ToTime(Time[0]) < 080000)
    Let me know if I can be of further assistance
    Cal H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    579 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X