Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Problem with an instance of indicator

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

    Problem with an instance of indicator

    Hi,

    I am developing a strategy in strategy builder but a I have the following error:

    Indicator 'ADXVMAColorBand': Error on calling 'OnStateChange' method: Object reference not set to an instance of an object.

    The indicator is displayed in the chart perfectly, only have problems when I create a simple strategy using it.

    I attached the code and the indicator.

    Thanks,
    Attached Files

    #2
    Hello jairotunior,

    Thanks for opening the thread. And welcome to the forums!

    The error is reporting a runtime error for that indicator in the OnStateChange() method. I recommend reaching out to the developer of this indicator and let them know you are hitting this issue when adding the indicator to a strategy.

    If you would like to debug and fix the issue yourself, I recommend adding prints after each line in OnStateChange() under State.SetDefaults and State.Configure so you can see which line of code throws the runtime error.

    At a glance, I can say it would not be advised to check for ChartBars.ToIndex or ChartBars.FromIndex in State.DataLoaded or in State.Configure since these objects will not be available until rendering has started on a chart. I would instead recommend to get this value after rendering has started and check for it as early as State.Historical.

    I've included a link on debugging - https://ninjatrader.com/support/foru...ead.php?t=3418

    You may also hire a NinjaScript Consultant who would be happy to review this code and apply any needed fixes. If that is the case, please let me know and I can have a member of our business development team reach out with additional information.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Jon17, Today, 04:33 PM
    0 responses
    1 view
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    6 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    10 views
    0 likes
    Last Post bltdavid  
    Started by alifarahani, Today, 09:40 AM
    6 responses
    41 views
    0 likes
    Last Post alifarahani  
    Started by Waxavi, Today, 02:10 AM
    1 response
    21 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Working...
    X