Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetSessionBar() no longer working on Beta 21

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

    GetSessionBar() no longer working on Beta 21

    I am having issues trying to replace the old function GetSessionBar() which most of my indicators and strategies were using ...

    So, when trying to check if current bar is on same day than previous I was using
    if (Bars.GetSessionDate(Time[0]) != Bars.GetSessionDate(Time[1]))


    Now I changed to this :
    if( Bars.GetDayBar(0).Time != Bars.GetDayBar(1).Time )

    ...and it works....but only on indicators...
    What should be used on strategies ?

    BTW : Why have u discontinued a funtion instead of just adding a better one ...?

    Now I have a lot of errors to compile and no way to go back to previous version...
    pmaglio
    NinjaTrader Ecosystem Vendor - The Indicator Store

    #2
    Hello,

    Thank you for your note.

    When doing this on my side here is the error I get in the log tab:

    Error on calling 'OnBarUpdate' method for strategy 'Hello/1308f0473b3e4e83baaf1e2d71d03bc7': GetDayBar() should only be used for accessing prior trading day data. To access current trading day data, please use the CurrentDayOHL() method.

    Since your needing the current time use Time[0].Date instead for the Time[0] check.

    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Thanks Brett,

      The way of checking current bar is on different day than previous ( Time[0].Date != Time[1].Date ) works fine.
      Question : To make my code backwards compatible with previous Ninja 7 betas and Ninja 6.5,
      would that code produce the same results than Bars.GetSessionDate(Time[0]) ( like used on @PriorDayOHLC on Ninja 6.5 ) ?
      pmaglio
      NinjaTrader Ecosystem Vendor - The Indicator Store

      Comment


        #4
        Hello,

        It did return the same results in my testing.

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment


          #5
          I cannot even compile original NT7 indicators, because of this error message. I'm using NT7 Beta 22 and this problem exists for some beta versions.
          I want to create a new indicator, but I get this error message, when I want to compile it. What happens?
          so I cannot even create an empty indicator...

          Comment


            #6
            Okay, I fixed it on my own. Delete the original indicator "@PriorDayOHLC" (and maybe: "@CurrentDayOHL" - I deleted both) and it works fine. then you can compile your own indicators again...

            Comment


              #7
              Hello,

              I know you said you resolved the issue however here are the instructions to resolve this if this occurs again and for others to see.


              Please follow the instructions below to see where the errors are coming from after compiling the indicator. This will allow you to debug the indicator/strategy or remove it from your PC. If you are wondering why you receive an error when compiling only one indicator, it is because NinjaTrader compiles all indicators and strategies- not just one.
              Open NinjaTrader

              From the Control Center select the Tools menu--> select the Edit NinjaScript menu item--> select Indicator
              Select an indicator and double click on it.
              A new window will appear and you will need to right click in the window and select Compile to compile the indicators.
              At the bottom of the window a new section will appear were you can find the error locations.
              From there you have the option to remove the indicator or debug it.

              Let me know what errors are listed here or take a screenshot. To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CRTL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
              BrettNinjaTrader Product Management

              Comment


                #8
                hi, i stumbled across this post, i am having a similar problem. since downloading the latest version of NT, my PriorDayOHLC and my CurrentDayOHL do not display on my charts. i followed your instructions, here are screenshots of the code after compiling. please let me know how to fix this.

                thanks
                scott
                Attached Files

                Comment


                  #9
                  Hello,

                  Thanks for your post.

                  Can you please let me know what version of NinjaTrader you are using this is located in the Control Center under Help->About and is to the right of the NinjaTrader logo.

                  I look forward to assisting you further.
                  BrettNinjaTrader Product Management

                  Comment


                    #10
                    version 7.0.0.19

                    Comment


                      #11
                      Hello,

                      This is why most likely. Need to get you upgraded to version .23 the latest version and Release candidate one of the NinjaTrader 7 beta.

                      Download link: http://www.ninjatrader.com/webnew/do...g_software.htm


                      Let me know if I can be of further assistance.
                      BrettNinjaTrader Product Management

                      Comment


                        #12
                        that fixed it. i thought i was running the latest version, thank you

                        Comment


                          #13
                          Hello,

                          Excellent, Have a great rest of the day.

                          Let me know if I can be of further assistance.
                          BrettNinjaTrader Product Management

                          Comment


                            #14
                            Same issue

                            Hi Brett, I am having this same issue. I have imported an indicator and doesn't work. Can you please advise what the issue is with:

                            currentDate = Bars.GetSessionDate(Time[0]);

                            I have the latest version, screenshot attached. Thanks. DJ
                            Attached Files

                            Comment


                              #15
                              This method is unfortunately deprecated, please use GetTradingFromLocal() now for the task.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              598 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              343 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
                              557 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              556 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X