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

Error Message: "Error on requesting bars series"

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

    Error Message: "Error on requesting bars series"

    Hi there,

    I have been working on a custom indicator and every time I add it to my chart I receive this error message multiple times:

    Error on requesting bars series: 'From-date (2099/12/01 00:00:00) must to be smaller than to-date (1800/01/01 00:00:00)'

    Here is a screenshot of the error message: https://ibb.co/k4W8gBB

    Oddly enough, once I close these error message boxes, the indicator works perfectly fine.

    Does anyone have any advice on how I could prevent this error message from popping up every time I add my indicator to a chart?

    Thanks in advance
    Last edited by RoswellTrader; 08-21-2023, 10:58 AM.

    #2
    Hello RoswellTrader,

    Thank you for your post.

    It seems that somewhere there is a start date and end date field that might be causing this error.

    So I may accurately assist you, please answer all of the following questions:
    • What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About (Example: 8.?.?.?)
    • Does your indicator take any start/end date information as user input parameters?
    • For the data series on the chart, are you loading data based on Bars, Days, or a Custom Range?
    • Which connection are you connected to? This is displayed in green in the lower-left corner of the Control Center window.
    • What instrument symbol (and expiry if applicable) have you selected? For example, ES 03-22, AAPL, EURUSD, etc.
    • (For a chart) what interval is selected? For example, 5 minute, 1 day, 2000 volume, 4 Renko, etc.
    I would be glad to test and see if I get this same error message on my end with a blank chart and no template applied. If you'd like to provide the indicator (or a reduced sample) please export it via Control Center > Tools > Export > NinjaScript AddOn and attach the .zip file that gets generated from the export.

    I look forward to your reply.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Hi Emily, thank you so much!

      Here are the answers to your questions:
      • I'm using NinjaTrader 8.1.1.7 (64-bit)
      • My indicator doesn't use any start/end date information taken as user input parameters. It operates on the input series (tick chart/time chart) that I apply the indicator to, and it calculates based on the bars of that input series.
      • I typically only use a 377-tick chart for trading ES futures.
      • I'm currently only using my indicator with "Market Replay" data for backtesting purposes.
      • The instrument symbol I'm using is ES 09-23.

        I'd love to share the script with you for troubleshooting, but unfortunately the team I am working with wants to keep it private for now while it's still in development.

        Sorry about that, hopefully the details I've supplied you with will help to solve this issue.

        Your help is much appreciated.

      Comment


        #4
        Hello RoswellTrader,

        Thank you for your reply.

        No worries, sharing your script is optional and I completely respect that the team wants to keep it private. Market Replay also uses a start date and end date - I am curious if this is related to the errors. If you add the indicator to a chart on a different connection, do you get the same error messages? When you run the test on the Playback connection, what are the values for "Start" and "End" in the Playback controller? Right-click the Playback controller and advise which option is checked: Playback current day, Playback from selected, or Playback from start?

        I look forward to your reply.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Hi Emily, thanks so much for your understanding.

          I have added the indicator to a new chart using different connections and I'm still receiving the same error messages.

          My playback controller is using "Playback from selected", specifically from 17/07/2023 - 29/07/2023

          I have also just selected "Playback current day" as well as "Playback from start" and that hasn't made a difference.

          Such a strange error since the "from-date" is (2099/12/01) and the "to-date" is (1800/01/01)

          Do you think this could have something to do with the code? Maybe the "using declarations" at the top of the script?​

          Comment


            #6
            Hello RoswellTrader,

            Thank you for your reply.

            Please review the OnStateChange() portion of the indicator and ensure that any logic that needs access to data-related objects is only included during or after State.DataLoaded. For example, trying to initialize a custom Series<T> object or call an indicator prior to State.DataLoaded, such as in State.Configure, could result in this type of error. For more information, please see the OnStateChange() page of the help guide:


            You could even consider adding a Print() statement every few lines throughout your script with the line number, then the last print that shows in the NinjaScript Output window prior to the error being thrown can be a clue as to what portion of code is causing the error. For more info on adding Prints to debug a script:


            Please feel free to reach out with any additional questions or concerns.
            Emily C.NinjaTrader Customer Service

            Comment


              #7
              Hi Emily,

              Thanks for all the amazing advice. After setting up the 'OnStateChange()' section correctly, the issue has been solved!

              Very interested to learn more about Print() statements too, so thanks for mentioning that in your message.

              All in all, so grateful for your help, it is greatly appreciated!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by pecunianonolet, 11-28-2016, 03:34 AM
              6 responses
              4,511 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by reynoldsn, Today, 07:23 AM
              4 responses
              10 views
              1 like
              Last Post NinjaTrader_Gaby  
              Started by bee1943, Today, 09:55 AM
              1 response
              13 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by FAQtrader, 04-25-2024, 12:00 PM
              7 responses
              103 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by giulyko00, Yesterday, 11:49 AM
              4 responses
              28 views
              0 likes
              Last Post giulyko00  
              Working...
              X