Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bug in ninjatrader

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

    Bug in ninjatrader


    there is obvious bug in NT, look closely on screenshot to understand the bug.
    the strategy was attached to higher timeframe dataserie and it uses "AddDataseries" to add another granular dataserie and 47579 bar was happened on secondary BarsInProgress
    Attached Files
    Last edited by ttodua; 07-06-2024, 07:01 AM.

    #2
    Hello ttodua,

    From only an image I would not be able to say there is any kind of bug, I would need a way to test this on my end using a simplified script. If you have a simple test that you can provide which outlines a problem please feel free to upload that sample so we can review the situation.

    BarsAgo messages in the platform heavily relate to the use case, if you are using multiple series Time[1] may not have been valid at the time it was called. Try removing the secondary series as a first step to see if you still get the error, if so continue to reduce the script until you have a specific use case where you see that error happening. Once the code is simplified it will be easier to know why you are seeing that message.

    I would also suggest avoiding using try/catch and instead allow the script to be stopped when you see the error. That helps to keep output isolated so you can see exactly when the script stopped and prevent any further processing. The catch information for this type of error would not be helpful in finding the cause.

    Comment


      #3
      Hi Jesse, thanks for response
      1) the obvious issue is underlined with red line in that screenshot. "BarsAgo should be between 0 and 89999 and was 1" - is not that an erroneous output?
      2) try catch is more than preferred in such cases, because by defualt ninjatrader outputs only exception message, and not stracktrace (line/etc) which i was requesting years ago but NT hasnt added that capability, so try->catch->exception.ToString() is the only way to find out which line throws

      Comment


        #4
        Hello ttodua,

        Using a screenshot for a coding issue is not a good way to try and provide details unless a very specific message is being reported, you have pictured a generic message that does not provide helpful information to know why that happened. If you think there is a bug specifically and not just a logical problem with your code we need a concrete sample that demonstrates the issue so we know what code and steps were used to know if that is expected or not.

        Try catch would not be preferred in this case because that does not provide any relevant information we can use to know why that happened, we would need to see what code was used and have details surrounding the use case to know why that bars ago was invalid at that time. Try/catch is a C# concept which outputs the exception information, for specific C# errors that can be useful, for NinjaScript runtime errors where some ninjascript specific scenario or properties are involved that is not useful for troubleshooting and will allow the script to keep running while in error.

        If you would like to continue troubleshooting this issue you will need to reduce the code to make a small sample that demonstrates the problem and then attach that, I can otherwise only suggest that you use prints to debug the script to better isolate what specific problem you are having when trying to use that bars ago when whichever series was processing in OnBarUpdate at that time.



        Comment


          #5
          Email support (from NT itself) didnt work so i couldnt send the logs/traces from there, but on screenshot, it's shown the full stack and print log (`Timeseries getter` throwing issue and saying that it expected value between `0 and 89999` and got `1` , however that statement is a bug by itself) so it would have been enough hint to locate that piece of internal codes, but if you can't check that, then i'm left without choice at this moment.
          if i will minimize the demonstrating code, i'll post here.
          thanks for responses

          Comment


            #6
            Hello ttodua,

            Log and trace files won't help with a bars ago error, that is a runtime error that is not logged.

            The stack doesn't help to explain what situation the script was running in, we would need specific details like what BarsInProgress was calling OnBarUpdate at that time, what series were being used, what settings on the chart were used. There are many missing details from the image so making a test script would be necessary to troubleshoot that type of error. When working with multiple series there are many complexities that you can run into so that type of use case really requires specific details to know what may have happened.

            Comment


              #7
              in the top post i've noted this happened on `2nd BarsInProgress`, but it might not be enough info as you say.

              Comment


                #8
                Hello ttodua,

                Correct that is still not enough information to go on to know why a bars ago error happened.

                Just as a simple demonstration of why we need more information. If you were using a tick series and a larger series like a day series. If 47k ticks were processed and then BIP 1 was called for a daily series where 1 day has not elapsed you would get this type of error.

                The reason the try/catch is not relevant is because that is letting us know the min and max limits of the count of one of the series which is useless if we don't have specifics on where in processing the script was at that exact time. That is also why it is very important to not use try catch because that will let the script keep processing past that point which makes it more confusing to debug.Stopping the script at the time of the error is an important debugging tool as that allows you to inspect the values at the time right before the error and then have no follow up information that is not useful.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                58 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                38 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                19 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                20 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                50 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X