Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing Sessions

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

    Changing Sessions

    In 6.5 I could programatically change the session times by setting ChartControl.SessionBegin and ChartControl.SessionEnd. These properties are no longer available and I'm trying to reproduce this functionality by changing the Bars.Session.TemplateName property. The property changes but the chart does not reflect the change. Is there anything we can use to cause the chart to reflect the new session template?

    #2
    You would not want to change the template, but rather just the individual sessions begin/end time definitions.

    Bars.Session.SessionsOfDay[].BeginTime
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      hemlock,

      Actually, please clarify what you mean by pro grammatically changing the session times? In 6.5, you could access them via SessionBegin/End, but changing those values would not change anything drawn on the chart. There is no logic to add bars or drop bars depending on what you change SessionBegin/End to.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Josh,

        In 6.5 when you changed either SessionBegin or SessionEnd it would automatically refresh the indicator/chart (similar to pressing F5). The problem was when you changed SessionBegin it would refresh the chart, but, if you then followed up in the code changing SessionEnd it would throw an error because ChartControl was null (I assume because it was in the middle of a refresh, old code was still running, new code was starting up, something along those lines). The trick was to save ChartControl off into another variable and reference that variable when you changed SessionEnd. When SessionEnd was changed it then did another refresh.

        Needless to say this was a lot of messing about with things that you all would never recommend, but, it worked. And for me it was handy to have a dropdown on the toobar where I could change the session times without going into the properties dialog.

        Is there anyway I could reproduce this functionality within NinjaScript in version 7?

        Thanks.

        Comment


          #5
          Unfortunately this would not be support (as it wasn't in NT6.5, although it might have worked there with some tricks).

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          626 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          359 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          562 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          567 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X