Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

range bars and session manager

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

    range bars and session manager

    I reported this a very long time ago....do not remember reply...however still a problem

    if you create a session that ends at 4:05 PM eastern and starts at 4:35 PM eastern (to avoid overnight margin calculations), and use a 4 range chart, bars.firstbarofsession does not recognize the open of the session

    this I assume is due to the way range bars are constructed

    a 5 min and 1 min chart, no problem....a 3 min, problem same as range bars...i.e. NT does not recognize session open

    this is extremely annoying if you are placing trades from code after the session opens...since the session never opens

    ...edit....

    problem seems to be related to Days Ago....1 and 2 days ago works fine (i.e. NT pickup up first bar of session) however 3 and greater do not

    also might be related to session manager

    I am trading the 6e contract on a 4 range with the attached session template
    Attached Files
    Last edited by ATI user; 11-22-2010, 04:56 PM.

    #2
    This has been confirmed fixed a long time ago. With your session template and an indicator that simply colors the background green, we can see in the screenshot that every session break is accompanied by the green background. Screenshot is of 10 days back.
    Attached Files
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      thanks Josh

      problem is the way my strategy code closes the session...i.e. it compares bar time to a user paramter input of 160000 (4pm eastern)
      this does not close the session on a range chart on today, Monday, of more than 2 days back...and a 3 min chart

      I need a better way to find last bar of session or close session in code a differenet way,,,,or just reset on open and not close at all.....problem with that is I might leave a trade open after the session closes....ideas?

      Comment


        #4
        Originally posted by ATI user View Post
        thanks Josh

        problem is the way my strategy code closes the session...i.e. it compares bar time to a user paramter input of 160000 (4pm eastern)
        this does not close the session on a range chart on today, Monday, of more than 2 days back...and a 3 min chart

        I need a better way to find last bar of session or close session in code a differenet way,,,,or just reset on open and not close at all.....problem with that is I might leave a trade open after the session closes....ideas?
        of course I could use
        protected override void Initialize()
        {
        // Triggers the exit on close function 30 seconds prior to session end
        ExitOnClose = true;
        ExitOnCloseSeconds = 30;
        }

        Comment


          #5
          Have you thought about adding another series and using Times then for getting access to more granular timestamps?

          Comment


            #6
            Originally posted by NinjaTrader_Bertrand View Post
            Have you thought about adding another series and using Times then for getting access to more granular timestamps?
            thanks...have done that in the past

            in this case, can not spare the computer resources....plus I like the exit on close function for safety

            Comment


              #7
              here is a concern....Exit on Close only works on one position...i.e. long or short...not both....so should you be in a hedge (both long and short in same account at same time) Exit on Close leaves one position open after session close

              I need to Flatten Account on close not just exit one position
              Last edited by ATI user; 11-29-2010, 04:11 PM.

              Comment


                #8
                Not quite following you. A single strategy would never allow you to be long and short at the same time. If you have two strategies, setting ExitOnClose for both of them will close both respective strategy positions.

                Otherwise you can just program your own logic to exit your positions based off of DateTime.Now.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Josh View Post
                  Not quite following you. A single strategy would never allow you to be long and short at the same time. If you have two strategies, setting ExitOnClose for both of them will close both respective strategy positions.

                  Otherwise you can just program your own logic to exit your positions based off of DateTime.Now.
                  using atmstrategycreate it is simple to put on a hedge..which I use often

                  DateTime.Now brings me back to the same range bar timing issue above does it not?

                  Comment


                    #10
                    DateTime.Now is based off of your PC clock instead of any bar's timestamp. As long as you are running CalculateOnBarClose = false, you will have enough events triggered where you can check your PC clock for 30 seconds ahead of session close.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_Josh View Post
                      DateTime.Now is based off of your PC clock instead of any bar's timestamp. As long as you are running CalculateOnBarClose = false, you will have enough events triggered where you can check your PC clock for 30 seconds ahead of session close.
                      thanks Josh

                      do you think this would be more reliable/safer than adding a 1 min series just for the purpose of checking end of session?...per post above by Bertrand....

                      also...would an added 1 min series slow my strat much if only used to check time?

                      Comment


                        #12
                        I wouldn't say it is any more reliable or safe than Bertrand's suggestion. Bertrand's suggestion will for sure use a bit more resources, but minimal at that as long as you are not doing something with excessive amounts of days back.

                        DateTime.Now comes with the limitation that testing the strategy on replay and such would become a bit troublesome since it really checks your PC clock time and not whatever time the replay data is at.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          thanks Josh...based on that I need to use the 1 min series..which will only deal with the current day on a chart with max 4 days historical...so should be neglible re resources

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          599 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          344 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          103 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          558 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          557 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X