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

NT8 glitch

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

    NT8 glitch

    My code was working properly last night with no errors over a period of 5 days in market replay and today, when I try to debug it further with Visual Studio, is stops before the script is fully loading with the error "System.NullReferenceException: 'Object reference not set to an instance of an object.' " on DMI indicator, which is a system indicator I wont be able to modify, even if I wanted to. What is even stranger is that the error seems to be completely ... well.. erroneous, since "double low1 = Low[1];" seems to me properly declared in the first place.
    Restarting the platform did nothing to fix this.
    Attached Files

    #2
    Hello itrader46,

    Does the script give an error when running in NinjaTrader?

    What is the null object?

    Is Low[1] the null object?

    If you add
    Code:
    if (CurrentBar < 1)
    Print("less than 1");
    
    if (Low[1] == null)
    Print("Low[1] is null");
    What prints to the output window?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      The script does not even start in NT8, as it throws the exception immediately and I can't add those lines in the system DMI indicator code, as I would then have to save a custom DMI, then modify my script to use the new new indicator

      Comment


        #4
        Hello itrader46,

        This error is occurring when adding the unmodified MDI indicator to a chart?

        Are you using 8.0.20.1?

        Is there data appearing on the chart?
        Last edited by NinjaTrader_ChelseaB; 12-30-2019, 09:11 AM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I am using 8.0.19.1, as I was not aware of any update, data appears to be normal on the chart, this is happening indeed with the unmodified system DMI indicator, without me having made any changes between last night when it worked OK and now and the DMI is added by the script itself

          Comment


            #6
            Hello itrader46,

            Are you adding this indicator directly to a chart and getting this error without calling this from another script?

            If so, I would like to schedule a call with you to take a look.


            Currently, NinjaTrader has released 8.0.20.1.

            Updates to NinjaTrader will contain the latest security updates and bug fixes, as well as new instruments and rollover dates.

            To update NinjaTrader
            • Shutdown all programs including NinjaTrader *important
            • Download NinjaTrader from the public link below
              Click here to download NinjaTrader
            • Double click the downloaded file to execute it
            • Follow the on screen instructions
            • Restart NinjaTrader
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I am calling the DMI indicator from the script.
              I will update NT8, then email you when can we schedule that call, in case the update doesn't fix it, coz I have to go somewhere now.
              Thank you

              Comment


                #8
                Hello itrader46,

                If you add the DMI indicator to the chart directly without calling this from another script, does the indicator appear on the chart?

                What code is used in the host script that is calling the indicator?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  OK, so I updated NT8 to 20.1, started the platform and I have now the exact same error that prevents me from running the script that yesterday was just fine, because NT8 seems to think a system indicator that can't be modified to begin with, is somehow not right anymore.

                  The DMI works fine if I apply it on a different chart and here is the code I'm using in my script, although it won't be the code, as it compiles OK and the error refers to DMI, not to my script

                  At this point I would appreciate some assistance, so you can call me on Skype(sorin.pascu1) before the end of play today. Please confirm

                  Thank you

                  Code:
                  public class Divergence : Strategy
                      {
                         private DMI DMI1;
                  ......
                  protected override void OnStateChange()
                          {                  
                              else if (State == State.Configure)                
                              {
                                  AddDataSeries(Data.BarsPeriodType.Tick, 1);
                                  AddDataSeries(Data.BarsPeriodType.Minute, 5);   
                  .........
                  else if (State == State.DataLoaded)
                              {                
                                  DMI1            = DMI(Closes[2], Convert.ToInt32(DmiPeriod));            
                                  DMI1.Plots[0].Brush = Brushes.Transparent;
                                  AddChartIndicator(DMI1);                    
                                  DMI1.Panel = 1;

                  Comment


                    #10
                    Hello itrader46,

                    If you would like a call for assistance you will need to send an email to platformsupport [at] ninjatrader [dot] com.

                    The error is likely in the code of your script.

                    What is the specific line that causing an error?

                    Attached is a test script that adds the DMI indicator to a chart.
                    Does this test script also cause an error on your end?
                    Attached Files
                    Last edited by NinjaTrader_ChelseaB; 12-30-2019, 03:08 PM.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      As I mentioned already, there is no line in my script that generates the error, but Visual Studio flags the line in the DMI indicator as in the attachment from my first post.
                      The sample you provided works fine, though

                      Comment


                        #12
                        Hello itrader46,

                        I'm not able to address Visual Studio.

                        When you state:
                        "there is no line in my script that generates the error"

                        Does this mean that if you comment out those lines in your script that the error continues to appear?

                        Are you having an issue with the indicator being added to the chart?

                        Does the error appear on the Log tab of the NinjaTrader Control Center?

                        Have you tested the script I have provided you and experienced the same error?
                        (If not, this tells you the error is in your script, and the error is not with the DMI indicator)
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          "When you state:
                          "there is no line in my script that generates the error" "
                          That means that when I debug with Visual Studio, the error in my first screenshot comes up and VS highlites the line of code in DMI indicator code, not any line in my script and that happens not while the script runs, but while the script is loading.
                          Basically, when a script runs while in VS debug mode and it encounters an error, it stops, the VS highlights the line with the error and prints the error message, as in my screenshot.
                          It's quite unusual for it to point an indicator code used in the custom script, as it is for it to do that even before the script loads.

                          Comment


                            #14
                            Hello itrader46,

                            I have received your email in our platform support ticketing system and will be continuing this conversation privately.
                            Chelsea B.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by junkone, Today, 11:37 AM
                            0 responses
                            0 views
                            0 likes
                            Last Post junkone
                            by junkone
                             
                            Started by quantismo, 04-17-2024, 05:13 PM
                            5 responses
                            33 views
                            0 likes
                            Last Post NinjaTrader_Gaby  
                            Started by proptrade13, Today, 11:06 AM
                            1 response
                            5 views
                            0 likes
                            Last Post NinjaTrader_Clayton  
                            Started by love2code2trade, 04-17-2024, 01:45 PM
                            4 responses
                            34 views
                            0 likes
                            Last Post love2code2trade  
                            Started by cls71, Today, 04:45 AM
                            2 responses
                            10 views
                            0 likes
                            Last Post eDanny
                            by eDanny
                             
                            Working...
                            X