Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Finding out if a time is in a prior session

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

    Finding out if a time is in a prior session

    I want to find out if a bar from a few days ago is in the RTH or ETH session. I made a couple of sessionIterators with the trading hours templates. But it seems that session Iterators will only tell me if a DateTime is in the current session, not if it was in a past session.

    What is the best way to find out if a datetime from a few days ago was in a session?

    #2
    Here's an example of what I'm doing. If you scroll around, it prints out whether the last bar visible on the screen is in the globex session or cash session
    Attached Files

    Comment


      #3
      Hello frantic,
      Thanks for your post.

      NT is only going to be able to check and see if the bar index you are referencing is inside the currently assigned session template. You would need to assign a static variable and store that information if you want to access it later.

      I think it would be easier to simply reference the template that you have(or had) attached to that instrument during that time.

      Please let me know if you have any questions.
      Josh G.NinjaTrader Customer Service

      Comment


        #4
        Hey Josh,

        I added additional Bars Series to the indicator, with the respective templates. It works for the current session, just not previous sessions for some reason.

        Comment


          #5
          Hello frantic,

          This is because that information is not recorded on the bar by NinjaTrader. If you want to have information about what session a specific bar was on than you will need to begin recording it.

          I can submit this as a feature request for you if you like, just let me know.
          Josh G.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by xiinteractive, 04-09-2024, 08:08 AM
          2 responses
          11 views
          0 likes
          Last Post xiinteractive  
          Started by Irukandji, Today, 09:34 AM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by RubenCazorla, Today, 09:07 AM
          1 response
          5 views
          0 likes
          Last Post RubenCazorla  
          Started by TraderBCL, Today, 04:38 AM
          3 responses
          25 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          11 responses
          1,423 views
          0 likes
          Last Post jculp
          by jculp
           
          Working...
          X