Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error when Reloading NinjaScript

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

    Error when Reloading NinjaScript

    I got the following error while debugging my NinjaScript. I had Scrolled back in time on my chart, almost to the Start of where the indicator started Drawing and Did an F5 ( Reload NinjaScript). I figured it was just the innner workings figuring it did not have enough bars on the chart to calculate and it attempted to load more. I just figured I would ask as I have had this happen several times and want to make sure their is not something more diabolical going on.

    2016-12-07 18:41:37:433 ERROR: Indicator '': Error on calling 'SetState' method: Object reference not set to an instance of an object.
    2016-12-07 18:41:37:436 ERROR: A hosted indicator tried to load additional data. All data must first be loaded by the hosting NinjaScript in its configure state.

    #2
    Hello JerryWar,

    Thanks for your reply.

    Please post the indicator and the steps to recreate (including instrument, bartype, time frame, etc.).

    Alternatively, feel free to send them into PlatformSupport[at]NinjaTrader[dot]Com, mark the e-mail atten:Paul and a link to this thread.

    Comment


      #3
      Paul
      I do send out my code, however, my OnStateChange() is below, Could you provide me with what kinds of Statements could cause this behavior.


      protected override void OnStateChange()
      {

      if (State==State.Configure)
      {
      AddDataSeries(BarsPeriodType.Tick ,343);
      AddDataSeries(BarsPeriodType.Tick ,1715);
      AddDataSeries(BarsPeriodType.Tick ,6860);
      SimpleFont mFont = new SimpleFont("Arial", mSize) { Bold = true };
      SimpleFont sFont = new SimpleFont("Arial", sSize) { Bold = true };
      SimpleFont pFont = new SimpleFont("Arial", 10) { Bold = true };
      SimpleFont miniFont = new SimpleFont("Arial", 7) { Bold = true };
      SimpleFont microFont = new SimpleFont("Arial", 8) { Bold = true };
      SimpleFont priceFont = new SimpleFont("Arial", 9) { Bold = true };
      }
      else if (State==State.SetDefaults)
      {
      //PrintTo = PrintTo.OutputTab2;
      Name = "TrpScrnV1";
      Description = "Intended as Price Oscillation indicator ";
      IsSuspendedWhileInactive = false;
      Initialize();
      }
      }

      Comment


        #4
        Hello JerryWar,

        Thanks for your post.

        Would not be able to answer without seeing the whole picture. The errors reference SetState and they reference adding additional NS objects that use AddDataSeries. Are you adding a dataseries in Initialize()?

        Have you sent the indicator code and provided the steps to recreate?

        Comment


          #5
          It does not add any data series it adds some plots, it defines some wave file names.
          and some fonts. That is it.

          Comment


            #6
            Request Cancelled I believe I figured out a way to get around this.
            Last edited by JerryWar; 12-09-2016, 07:02 AM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            103 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            52 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            34 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            36 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            73 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X