Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I believe the SessionIterator.IsInSession() method has serious bugs

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

    I believe the SessionIterator.IsInSession() method has serious bugs

    I wrote some code to test the includesEndTimeStamp parameter impact of SessionIterator.IsInSession() method, then I found some serious problems I believe they're bugs. see the png.

    Please test the indicator on 6B or other FX futures on a 30min chart.

    And the document didn't explain the includesEndTimeStamp quite clearly, I thoutht the mothod code would be like this:

    if (includesEndTimeStamp)
    {
    if (time >= sessionBeginTime && time <= sessionEndTime)
    return true;
    ...
    }
    else
    {
    if (time >= sessionBeginTime && time < sessionEndTime)
    return true;
    ...
    }
    it's just used to determine whether <= or < should be used. But it seems that I am wrong from my test. So please make an clear explanation, thank you.
    Attached Files

    #2
    Hello jjhou,

    Thank you for your post.

    The includesEndTimeStamp produces true if the seconds of the timestamp are within the session, not just the minute or hour.

    For the first item in the Output, in my testing I see the includesEndTimeStamp is always within the session for the BeginTimeOutput. Are you using something other than the following in your tests?
    Code:
    var time = new DateTime(2017, 2, 16, 17, 00, 00);
    What time zone is your PC set to? I use Mountain Standard Time here in the States.

    For the second item, I would agree that based on your logic the testSI should not have changed simply because IsInSession was called for the session end time. I will look into this further on my end.

    My Output is attached to this post.

    I look forward to your response.
    Attached Files

    Comment


      #3
      My NT8 time zone is Center Time (UTC-6), the same as the CME forex exchange time zone.
      If you use Mountain Standard Time, the problem 1 won't happen because the trading hour 17: 00 and 16:00 I wrote in code is defined for CT timezone.
      So please change your NT8 time zone to Center Time then test again, I believe you'll see the same output as mine.

      My windows' time zone is UTC+8 (Beijing), I don't think it matters with the test output.
      Last edited by jjhou; 03-02-2017, 08:11 PM.

      Comment


        #4
        Hi, Patrick

        Now I found the GetNextSession() also has similar problem, maybe all the methods with includesEndTimeStamp parameter have this problem I think.

        I updated my indicator, and a new snapshot.

        Again, please test the indicator on 6B or other FX futures on a 30min chart with NT8 time zone config set to CT(UTC-6).

        I tested it on NT8.0.3.1, NT8.0.4.0, NT8.0.5.0, all are the same.
        Attached Files

        Comment


          #5
          Hello jjhou,

          Thank you for your patience on this matter.

          In both Post #1 and Post #4 each subsequent call to IsInSession and GetNextSession pushes the session we are checking against forward one day as we are checking with the same bars.SessionIterator each time. We also are checking the date time which in the case of the GetNextSession winds up returning false as the session we are checking against is further ahead on the SessionIterator than one session (so it fails).

          Test out IsInSession calling the beginning and ending session times with different SessionIterators for each (do the same for GetNextSession).

          Attached is an example of doing so with IsInSesion.

          Please let me know if you have any questions.
          Attached Files

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 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
          553 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