Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.BarsSinceSession before Session Start time

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

    Bars.BarsSinceSession before Session Start time

    If the Session Start time = 930
    Session End Time = 1600

    If the time is 900 and I run Bars.BarsSinceSession is the result =-1 or does it report back -29? or something else

    Similary for after the Session end time what would I expect for Bars.BarsSinceSession? say it is 1615 what is the expectant result then?


    Regards

    #2
    Hello mefTrader,

    Thank you for your post.

    Bars.BarsSinceSession will be non-negative and start counting from zero starting at the first bar that opens after the session time.

    In your example, you are refering to times that are outside of defined session start and end times. These times won't exist in the context you're working from. There will not be a 9:00 bar or a 16:15 bar. There will be no strategy processing or indicator logic until 9:30.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      How do I check premarket?

      I currently have

      (ToTime(DateTime.Now) <= ToTime(9, 30, 00)

      Is my Session start time is 930

      how can I check if the current time is premarket i.e before 9,30,00 as in this case...

      Some thing like the following is what I want to do

      (ToTime(DateTime.Now) <= SessionStartTime

      can I do something like that?

      Comment


        #4
        Trying to make it generic! instead of a hard time i.e 9,30,00

        Comment


          #5
          (ToTime(DateTime.Now) <= ToTime(9, 30, 00)

          That statement will check your current system clock if before 9:30. This will only work in a live environment. (not backtesting)

          If you want it to check the system date/time against session start times, you can use the following:

          Code:
           
          if (ToTime(System.DateTime.Now) <= ToTime (Bars.SessionBegin))
          Ryan M.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          647 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          367 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          571 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X