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.
    Paul H.NinjaTrader Customer Service

    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?
        Paul H.NinjaTrader Customer Service

        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 selu72, Today, 02:01 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by WHICKED, Today, 02:02 PM
            2 responses
            12 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Started by f.saeidi, Today, 12:14 PM
            8 responses
            21 views
            0 likes
            Last Post f.saeidi  
            Started by Mikey_, 03-23-2024, 05:59 PM
            3 responses
            51 views
            0 likes
            Last Post Sam2515
            by Sam2515
             
            Started by Russ Moreland, Today, 12:54 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Erick  
            Working...
            X