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 Waxavi, Today, 02:10 AM
        0 responses
        4 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by TradeForge, Today, 02:09 AM
        0 responses
        10 views
        0 likes
        Last Post TradeForge  
        Started by Waxavi, Today, 02:00 AM
        0 responses
        2 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by elirion, Today, 01:36 AM
        0 responses
        4 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by gentlebenthebear, Today, 01:30 AM
        0 responses
        4 views
        0 likes
        Last Post gentlebenthebear  
        Working...
        X