• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Crashing during optimization

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

    Crashing during optimization

    Hello,

    I am on NT8B10 and optimizations are crashing NT or reporting errors preventing optimizations from running.

    I have a strategy that has BarsArray populated with 3 different sets of Tick Bars (i.e. 1000, 3000, 10000). When I try to optimize the strategy I am getting an error in the log stating Time Category Message 4/14/2016 12:39:55 PM Default Strategy 'XXX': Error on calling 'OnStateChange' method: Object reference not set to an instance of an object.

    I believe the error is generated at this line of code in the OnStateChange method:

    Code:
    pointValue = Instruments[0].MasterInstrument.PointValue;


    This works fine when just running a backtest but in optimization mode it causes the strategy to generate the erorr.

    Is there any reason why this code should not work on a multidata strategy when optimizing?

    Thanks,




    #2
    Hello,

    Thank you for the question.

    Would you be able to tell me what state this is currently being set in the script so I can create a sample of this?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      I have this code in the section for
      Code:
      if (State == State.Configure)
      Thanks

      Comment


        #4
        Hello,

        Thank you for the reply.

        It would seem this is to be expected per the help guide,
        http://ninjatrader.com/support/helpG...instrument.htm

        Instruments[0] is a Instrument object and based on the note this should NOT be accessed within the OnStateChange() method before the State has reached State.DataLoaded

        If your logic will allow for it, I would suggest moving the code to State.DataLoaded or later and test to ensure that works. if the logic would not allow for that, unfortunately there would be not much we could do in this case because the Instrument object is null at this point. You could of course check for null to prevent the error message but that would not assist in getting the value if it remains null where you need to use it.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by timcjpfx, Today, 03:52 AM
        0 responses
        1 view
        0 likes
        Last Post timcjpfx  
        Started by tonynt, Today, 01:42 AM
        0 responses
        7 views
        0 likes
        Last Post tonynt
        by tonynt
         
        Started by NT-Roland, Yesterday, 04:36 PM
        0 responses
        3 views
        0 likes
        Last Post NT-Roland  
        Started by Newtrader101, Yesterday, 03:40 PM
        2 responses
        13 views
        0 likes
        Last Post Newtrader101  
        Started by Branpo, Yesterday, 02:58 PM
        2 responses
        15 views
        0 likes
        Last Post Branpo
        by Branpo
         
        Working...
        X