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

Bars.GetDayBar(1).Time returning null

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

    Bars.GetDayBar(1).Time returning null

    Dear NT Support,

    I’ve solved the problem, but just in interest of all NT users and yourselves I thought I best post here.

    I’ve just been working with GetDayBar. It had been returning null exceptions.

    It was returning null exceptions. I’m running a multi-timeframe strategy with a focus on 60min charts with a secondary focus (i.e. Add(PeriodType.Minute, 1) of 1 min. GetDayBar was returning null when I was using it to track dates (i.e. currentDate = Bars.GetDayBar(1).Time). This would continue to return null object exceptions. However, when I added a third timeframe (i.e. Add(PeriodType.Day, 1)) the strategy ran fine and returned expected results.

    Are we required to have a “Day” timeframe for GetDayBar to operate correctly? Is that expected behaviour?

    Thanks and regards,

    drolles

    #2
    drolles, checking for null is advised when working with GetDayBar, as it could return null if there's not enough intraday data to build the virtual daily bar, so as you added the native daily series this was resolved - http://www.ninjatrader.com/support/h.../getdaybar.htm
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand,

      Thank for the prompt reply.

      I was setting the Min Bars Required up to 80 – 100 (of 60 min bars) that is not enough to fill the indicator? That is nearly a weeks worth of data.

      What would be in the min required?

      Thanks and regards,

      drolles

      Comment


        #4
        MinBarsRequired would mean how many bars for each series need to be present in order to call the OnBarUpdate() - so with this high setting you prevented the idea from working - how many days back of data were you loading?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Bertrand,

          Thanks for your reply.

          Your question was thought provoking so I’ve done some testing around this now.

          I set the Min Bars Required to 20, again with 60 min bars as target timeframe with secondary timeframe of 1 min bars.

          I’ve just got NT7 to crash backtesting my strategy.

          Sequence of events:

          1. Backtested on 2010 data (to date i.e. 22/10/2010) not connected to Esignal – backtestested fine
          2. Restarted NT7
          3. Backtested on 2010 data (to date i.e. 22/10/2010) not connected to Esignal – received Object exception message
          4. Backtested on 2009 data not connected to Esignal – backtested fine
          5. Connected to Esignal
          6. Backtested on 2010 data connected to Esignal – NT7 said loading missing data items – crashed

          Hope this helps with the beta.

          Kind regards,

          Dan

          Comment


            #6
            Can you please provide us with your complete log/traces? Thank you.

            Can you please provide us with the strategy you are using as well so we can see how exactly it is programmed? Thanks.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Josh,

              No problem.

              I have forwarded the log file referencing this thread. Unfortunately, I don’t think it is appropriate that I post the strategy here.

              I hope it helps the beta development.

              Kind regards,

              Dan

              Comment


                #8
                Thank you, Dan.
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  @drolles

                  I had similar problem in one of Indicator coding.

                  Later i realised it depends on Instrument's Session template.
                  It was mismatching of Session template that causing Null return, that i could correct with correct session template.

                  Hope it helps.
                  Devdas
                  NinjaTrader Ecosystem Vendor - Devdas

                  Comment


                    #10
                    Devdas,

                    Thanks for letting me know and the pointer towards the session template. I've not seen the problem for a while, but this is good for reference.

                    Kind regards,

                    drolles

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by trilliantrader, Today, 08:16 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post trilliantrader  
                    Started by AttiM, 02-14-2024, 05:20 PM
                    9 responses
                    174 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by funk10101, Today, 08:14 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post funk10101  
                    Started by adeelshahzad, Today, 03:54 AM
                    1 response
                    13 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by RookieTrader, Today, 07:41 AM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Working...
                    X