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:
      [COLOR=blue]if[/COLOR] (State == [COLOR=#2b91af]State[/COLOR].Configure)
      Thanks

      Comment


        #4
        Hello,

        Thank you for the reply.

        It would seem this is to be expected per the help guide,


        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 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