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 DJ888, Today, 10:57 PM
            0 responses
            1 view
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by MacDad, 02-25-2024, 11:48 PM
            7 responses
            158 views
            0 likes
            Last Post loganjarosz123  
            Started by Belfortbucks, Today, 09:29 PM
            0 responses
            7 views
            0 likes
            Last Post Belfortbucks  
            Started by zstheorist, Today, 07:52 PM
            0 responses
            7 views
            0 likes
            Last Post zstheorist  
            Started by pmachiraju, 11-01-2023, 04:46 AM
            8 responses
            151 views
            0 likes
            Last Post rehmans
            by rehmans
             
            Working...
            X